Skip to content

MoojaLabs/mooja-server

Repository files navigation

Mooja Server

NestJS API for protest coordination platform with organization verification and event management.

Quick Start

# Clone and install
git clone https://github.com/MoojaLabs/mooja-server.git
cd mooja-server
npm install

# Setup environment
cp .env.example .env

# Database setup
npx prisma generate
npx prisma migrate dev
npm run prisma:seed

# Start dev server
npm run start:dev

Environment Variables

Inside your .env file in the root folder (if u don't have it simply create one) add the following variables, check the .env.example for a guide on how to get each variable.

# Required
DATABASE_URL="postgresql://..."
DIRECT_URL="postgresql://..."
JWT_SECRET="your-secret-min-32-chars"
SUPABASE_URL="https://[project].supabase.co"
SUPABASE_SERVICE_ROLE_KEY="eyJhbGciOiJIUzI1NiIs..."

# Optional
PORT=3000
NODE_ENV=development
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100

API Endpoints

Auth

  • POST /api/auth/org/login - Organization login
  • POST /api/auth/refresh - Refresh token
  • GET /api/auth/org/profile - Get profile (auth required)

Organizations

  • POST /api/orgs/verify-code - Verify invite code
  • GET /api/orgs - Get orgs by country
  • GET /api/orgs/applications/:id/status - Check status

Protests

  • GET /api/protests - Public feed (paginated)
  • POST /api/protests - Create protest (auth required)
  • DELETE /api/protests/:id - Delete protest (auth required)

Other

  • POST /api/upload/image - Upload image
  • GET /api/health - Health check
  • GET /api/docs - API docs (dev only)

Database

npx prisma studio          # View data
npx prisma migrate dev     # Create migration
npx prisma migrate reset   # Reset DB

Scripts

npm run start:dev      # Development
npm run build          # Production build
npm run test           # Run tests
npm run prisma:seed    # Seed database

Tech Stack

  • NestJS + TypeScript
  • PostgreSQL (Supabase)
  • Prisma ORM
  • JWT Auth
  • Supabase Storage
  • Railway deployment

Security Notes

  • Keep your SUPABASE_SERVICE_ROLE_KEY secret - it has admin privileges
  • Use a strong JWT_SECRET (minimum 32 characters)
  • Never commit .env files to version control

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors