The API for the MoonCode app
api.mooncode.cc
This project is the API used to power the other main packages in the monorepo: dashboard and vscode-extension. It is built on top of Nestjs and powered by trpc.
To run the API, you need to first clone the repository
git clone https://github.com/Friedrich482/mooncode-monorepo.gitThen cd in the API
cd apps/apiThen install dependencies
npm installBefore continuing you'll need some environment variables: JWT_SECRET and DATABASE_URL.
-
NODE_ENV:NODE_ENV=production
-
DATABASE_URL: you can use:DATABASE_URL="postgresql://postgres:postgres@localhost:5432/mooncode"(Local database set up by docker compose as a docker volume. If you don't have docker installed, follow that link to the installation: Docker)
-
JWT_SECRET: Generate an SSL 64-character hexadecimal string.openssl rand -hex 32
-
GOOGLE_CLIENT_ID,GOOGLE_CLIENT_SECRET: you get them when you create credentials in the Google Cloud Console -
GOOGLE_REDIRECT_URI:GOOGLE_REDIRECT_URI=http://localhost:3000/auth/google/callback
-
GOOGLE_LINKING_REDIRECT_URI:GOOGLE_LINKING_REDIRECT_URI=http://localhost:3000/auth/google/linking/callback
-
ONBOARDING_EMAIL,RESET_PASSWORD_EMAILandUPDATE_EMAIL_EMAIL: those three can be obtained by creating an account on Resend and registering an email domain. For example:ONBOARDING_EMAIL=onboarding@<email_domain> RESET_PASSWORD_EMAIL=noreply@<email_domain> UPDATE_EMAIL_EMAIL=noreply@<email_domain>
-
RESEND_API_KEY: Resend API keyRESEND_API_KEY=re_...
Compile :
npm run buildThen start:
npm run start:prodThe API is currently deployed on api.mooncode.cc.
To dockerize the application, you need to place yourself at the root of the monorepo, then
docker build -t mooncode-api -f apps/api/Dockerfile --progress=plain .And to run a container called mooncode-api-container :
docker run -p 3000:3000 --name mooncode-api-container --env-file apps/api/.env mooncode-api:latestMIT License © 2026
