This is the open-sourced backend repository for Threadseeker. It's built with Nitro and Supabase as the database. We also use Redis as the cache.
# install dependencies
$ pnpm install
# serve with hot reload at localhost:3000
$ pnpm dev
# build for production and launch server
$ pnpm build
$ pnpm start
# preview production build
$ pnpm preview
You could write your own Dockerfile
to build a container for the app. The team recommends using Zeabur for the fast and easy deployment.
Before running the app, you need to set certain environment variables in the .env
file. The required variables are listed in the .env.example
file.
Threadseeker uses Supabase as its database. Create the tables described in the database/readme.md file in your Supabase or PostgreSQL database for the app to work.
For the data fetching task management and report GET
endpoint, we use Redis as the cache. You may need to set up your own Redis instance or use Upstash.
If using Upstash, please update utils/use-redis.ts
with this guide: Store data in an Upstash Redis database..
The routes/
directory contains your application handlers. You can create subdirectories inside routes/
dir to create nested handlers. The file name is the route path.
For more information, please refer to the Nitro documentation.
The api/ directory is similar to routes/ with the only difference that routes inside it will be prefixed with /api/ for convenience.
For more information, please refer to the Nitro documentation.
This directory contains your application utils with auto import support.
This app has several composable util for Redis connection, task management and Threads users and reports management.
For more information, please refer to the Nitro documentation.
This directory contains your application types. types/database.types.ts
is generated by Supabase (guide here).
Nitro Middleware are auto-registered within the middleware/
directory. A middleware can modify the request before it is processed, not after.
For more information, please refer to the Nitro documentation.
The nitro.config.ts file contains the configuration for Nitro.
For more information, please refer to the Nitro documentation.
This is a custom directory for the OpenAPI schema. You can add or modify the OpenAPI schema files in this directory, and import them in the the route meta.
This directory is not a default directory of Nitro. To avoid messing the api controller files, we separate the OpenAPI schema files to this directory.
In default, this app will generate the API documentation automatically.
You can access the API documentation at http://localhost:3000/_docs/_swagger
. The project enables the experimental doc generation and prerender the docs in production.
You could disable the doc generation in production by removing production
config in openAPI
section of nitro.config.ts
. If enabled, remember to protect your API docs endpoints.
The real-world API documentation of Threadseeker is available at here. We use Cloudflare Worker as a reverse proxy to protect the API docs without exposing the API host, and we also have the worker script open-sourced here.
We use Apache 2.0 for this project. See the LICENSE file for more information.