See CONTRIBUTING.md
You will need to provide the following environment variables:
CF_ACCOUNT_ID: Your Cloudflare account IDCF_WORKERS_AI_API_TOKEN: Your Cloudflare Workers AI API key
You can use these environment variables to customize the AI models used:
CF_TEXT_GENERATION_MODEL: Cloudflare Workers AI text generation model name (the default is@cf/meta/llama-3.2-1b-instruct)CF_TEXT_TO_IMAGE_MODEL: Cloudflare Workers AI text-to-image model name (the default is@cf/stabilityai/stable-diffusion-xl-base-1.0)
-
Clone the project to your workspace.
git clone <url> ttg-server cd ttg-server
-
Create a .env file with development presets. Then enter your own environment variables from the links above.
cp .env.example .env
-
Install and use the project's supported Node.js version.
With nvm:
nvm install
With fnm:
fnm install
-
Install dependencies.
npm install
-
Generate Prisma Client
npx prisma generate
-
Start backing services with Docker.
docker compose up # -d to detach i.e. run in backgroundThis starts MinIO, creates the default bucket, and starts Postgres. Wait for the services to finish starting, it takes a while before they're ready.
-
Start the server on
localhost:8080(or whateverPORTenvironment variable you specified)npm run start
- Language: JavaScript
- Server: Express
- Logging: Pino, pino-pretty
- Security: Helmet, Express/CORS
- Graceful Shutdown: Stoppable
- Rate Limiting: express-rate-limit
- Storage: Prisma, AWS SDK for JavaScript S3 Client
- Authorization: Passport.js
- Production: aws-jwt-verify, passport-http-bearer
- Local: http-auth, http-auth-passport
- Testing:
- Containerization: Docker
- Local Backing Services: Docker Compose, Postgres Docker Image, MinIO Docker Image
- Runtime: Node.js
- Runners: nodemon
- Package Manager: npm
- Version Control System: Git, GitHub
- CI/CD: GitHub Actions
- Linting: ESLint
- Formatting: Prettier
- Git Hooks: