Station is a modern full-stack monorepo application for managing gaming guilds and organizations with sophisticated role-based access control, member management, and secure authentication.
- React 18 with TypeScript
- Vite for fast development and builds
- Material-UI v6 for beautiful, accessible UI components
- React Router v6 for client-side routing
- Axios for API communication
- NestJS 10 with TypeScript
- PostgreSQL with TypeORM
- Redis for caching (with in-memory fallback)
- JWT Authentication with refresh token rotation
- Swagger/OpenAPI documentation at
/api/docs - Passport.js for authentication strategies
- bcrypt for secure password hashing
- pnpm workspace monorepo
- Turbo for fast, cached builds
- Docker & Docker Compose
- Kubernetes manifests for AWS EKS
- GitHub Actions CI/CD pipelines
- Husky pre-commit hooks
- lint-staged for code quality
- Monitoring: Prometheus & Grafana (configs available)
- Logging: ELK Stack (configs available)
station/
βββ backend/ # NestJS backend application
βββ frontend/ # React + Vite frontend application
βββ k8s/ # Kubernetes deployment manifests
βββ .github/ # GitHub Actions workflows
βββ .husky/ # Git hooks configuration
- Users can have multiple roles across multiple organizations
- Flexible JSONB-based permissions per role
- Optimized database queries with composite indexes
- Permission aggregation service with Redis caching
- Extended user profile fields (firstName, lastName, phoneNumber, bio)
- Profile management API with validation
- Phone number validation (E.164 format)
- Redis-based caching layer for frequently accessed data
- Automatic cache invalidation on data updates
- Graceful fallback to in-memory caching
- TTL-based cache expiration (5min for organization members, 15min for permissions)
- JWT access tokens (15-minute expiry)
- Refresh token rotation (7-day expiry)
- Secure password hashing with bcrypt
- Protected API endpoints with JWT guards
- CORS enabled
- Standardized error response format
- Input validation with class-validator
- Dark theme with gitaddremote.com inspired styling
- Medium blue accent color (#4A9EFF) with glowing effects
- Protected dashboard and profile pages
- Responsive Material-UI components
- Enhanced landing page with hero section
- Swagger API documentation with bearer auth
- TypeScript across the stack
- Hot module replacement with Vite
- Pre-commit hooks for code quality
- Monorepo with shared tooling
- Standardized API response transformation
- Node.js >= 18
- pnpm >= 8
- Docker & Docker Compose (for PostgreSQL and Redis)
-
Clone the repository
git clone https://github.com/YourUsername/station.git cd station -
Install dependencies
pnpm install
-
Start infrastructure services (PostgreSQL & Redis)
docker-compose up -d
This starts:
- PostgreSQL on port 5433
- Redis on port 6379
-
Set up environment variables
The
backend/.envfile should already exist. If not, copy from the example:cp backend/.env.example backend/.env
Default configuration:
DATABASE_HOST=localhost DATABASE_PORT=5433 DATABASE_USER=stationDbUser DATABASE_PASSWORD=stationDbPassword1 DATABASE_NAME=stationDb JWT_SECRET=your-super-secret-jwt-key-change-this-in-production REDIS_HOST=localhost REDIS_PORT=6379 PORT=3001 APP_NAME=STATION BACKEND
-
Run database migrations
cd backend pnpm typeorm migration:run -d src/data-source.ts
Run both frontend and backend in development mode:
# From root directory
pnpm dev
# Or individually from root:
pnpm dev:backend # Backend on http://localhost:3001
pnpm dev:frontend # Frontend on http://localhost:5173
# Or from package directories:
cd backend && pnpm dev # Backend only
cd frontend && pnpm dev # Frontend onlyNote: Redis is optional. The application will fall back to in-memory caching if Redis is unavailable.
# Build all packages
pnpm build
# Build specific package
cd backend && pnpm build
cd frontend && pnpm buildOnce the backend is running, visit:
- Swagger UI: http://localhost:3001/api/docs
- Frontend: http://localhost:5173
# Run all tests
pnpm test
# Backend tests
cd backend
pnpm test # Unit tests
pnpm test:e2e # E2E tests
pnpm test:cov # Coverage reportFrom root directory:
pnpm dev- Run all packages in development modepnpm build- Build all packagespnpm test- Run tests across all packagespnpm lint- Lint all packagespnpm format- Format code with Prettierpnpm typecheck- Type-check all packages
- Register:
POST /auth/register - Login:
POST /auth/loginβ Returnsaccess_token+refresh_token - Access Protected Routes: Include
Authorization: Bearer <access_token> - Refresh Token:
POST /auth/refreshwithAuthorization: Bearer <refresh_token> - Logout:
POST /auth/logoutβ Revokes refresh token
- Users: User accounts with hashed passwords
- Organizations: Gaming guilds/organizations
- Roles: Role definitions with JSONB permissions
- UserOrganizationRoles: Junction table linking users to organizations with roles
- RefreshTokens: Secure refresh token storage
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
Pre-commit hooks will automatically run linting and formatting.