Skip to content

cpe-kmutt-student/comcamp37-backend

Repository files navigation

ComCamp 37 - Backend

Stacks

  • Node.js
  • NestJS (base on Express.js)
  • TypeScript
  • Supabase (postgreSQL)
  • Prisma
  • JWT
  • Docker

Prepare Project

  • Clone this repository : git clone https://github.com/cpe-kmutt-student/comcamp37-backend.git
  • Install Dependencies : pnpm install (pnpm recommend)
  • Config .env by rename or copy from .env.example
  • generate prisma client : pnpm exec prisma generate

DB Migration

  • Run Generate : pnpm exec prisma generate
  • Run Migration : pnpm exec prisma migrate dev
  • Reset and Re-run Migration : pnpm exec prisma migrate reset

Commit rules

  • feat – New feature
  • fix – Bug fix
  • perf – Performance improvement
  • refactor – Code change without behavior change
  • style – Code style only (no logic change)
  • test – Add or update tests
  • docs – Documentation only
  • build – Build system or dependencies
  • chore – Maintenance tasks
  • ci – CI/CD configuration
  • revert – Revert previous commit

Start Dev

  • Run Dev Server : pnpm run start:dev

Start Prod

  • Run Prod Project on docker (recommended) : docker compose up --build -d

DB-Diagram (Prototype)

ER-Diagram

API Flow Design (Prototype)

Open on Figma

.env Field Explanation

APP_PORT                  :: Application Port (e.g., 3000)
APP_ALLOW_ORIGIN          :: Allowed Origin for CORS (e.g., http://localhost:3000)
APP_FRONTEND_URL          :: Frontend URL (e.g., http://localhost:3000)

AUTH_JWT_SECRET           :: JWT Secret Key
AUTH_GOOGLE_CLIENT_ID     :: Google OAuth Client ID
AUTH_GOOGLE_CLIENT_SECRET :: Google OAuth Client Secret
AUTH_GOOGLE_CALLBACK_URL  :: Google OAuth Redirect URL (e.g., http://localhost:3000/auth/google/callback)

DATABASE_URL              :: PostgreSQL Database URL (e.g., postgresql://user:password@host:port/database)

S3_REGION                 :: S3 Region (e.g., us-east-1)
S3_ENDPOINT               :: S3 Endpoint URL (e.g., https://s3.amazonaws.com)
S3_ACCESS_KEY             :: S3 Access Key ID
S3_SECRET_KEY             :: S3 Secret Access Key
S3_BUCKET                 :: S3 Bucket Name

Connect with Frontend (Development)

If you don't want to deploy on your own machine, you can use this proxy server for simulate server : Clone this repository

*** Caution: Don't change the port cause i have set the Google Callback URL like this ***

*** Caution: Dont forget to add /auth ***

BETTER_AUTH_BASE_PATH=http://localhost:3030/auth

Cr.

Made with 🧡 by ComCamp 37 Technic Team

About

ComCamp37 - API Backend Server

Resources

License

Stars

Watchers

Forks