Skip to content

cpe-kmutt-student/comcamp37-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

587 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ComCamp 37 Logo

🐰 ComCamp 37 - Backend 🦊

The official RESTful API for the ComCamp 37 registration website.

Node.js TypeScript pnpm Express.js Prisma TypeORM PostgreSQL Passport JWT Google OAuth Swagger React Email Nodemailer Resend MinIO Supabase Multer pdf-lib ExcelJS Biome ESLint Prettier Husky Docker Docker Compose Traefik Watchtower GitHub Container Registry

Stacks

  • Node.js
  • NestJS (base on Express.js)
  • TypeScript
  • Supabase (postgreSQL)
  • Prisma
  • JWT
  • Docker
  • Swagger
  • Scalar
  • Better Auth
  • MinIO (S3 Compatible Object Storage)
  • GitHub Container Registry (GHCR)

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 exec dotenv -e .env.prod -- pnpm run start:dev

Start Prod

  • Run Prod Project on docker (Build from source) : docker compose up --build -d
  • Run Prod Project on docker (Pull from GHCR + Scale (Recommended)) : docker compose -f docker-compose.prod.yml --env-file .env.prod up -d --scale client=3

DB-Diagram (Final)

Open on DB Diagram
DB Diagram

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 /api/auth ***

BETTER_AUTH_BASE_PATH=http://localhost:3030/api/auth

Reference & Endpoint

  • Dev Server : http://dev-api.comcamp.io
  • Prod Server : http://api.comcamp.io
  • Docs (Swagger) : /docs
  • Docs (Scalar) : /reference
  • Docs (Better Auth) : /api/auth/reference

Object Storage Server (S3 Complatible)

  • Endpoint : https://storage.comcamp.io
  • Console : https://console-storage.comcamp.io

Cr.

Made with 🧡 by ComCamp 37 Technical Team

About

ComCamp37 - API Backend Server

Resources

License

Stars

Watchers

Forks

Contributors

Languages