Skip to content

Station is a full-stack application designed as a portal for managing gaming guilds and organizations, complete with member features, secure data management, and robust backend services. It leverages modern cloud technologies for orchestration, scaling, and CI/CD, making it powerful and scalable.

License

Notifications You must be signed in to change notification settings

GitAddRemote/station

Repository files navigation

Station: Gaming Guild and Organization Portal

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.

πŸš€ Tech Stack

Frontend

  • 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

Backend

  • 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

DevOps & Infrastructure

  • 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)

πŸ“ Project Structure

station/
β”œβ”€β”€ backend/          # NestJS backend application
β”œβ”€β”€ frontend/         # React + Vite frontend application
β”œβ”€β”€ k8s/             # Kubernetes deployment manifests
β”œβ”€β”€ .github/         # GitHub Actions workflows
└── .husky/          # Git hooks configuration

🎯 Key Features

Multi-Role Organization System

  • 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

Enhanced User Profiles

  • Extended user profile fields (firstName, lastName, phoneNumber, bio)
  • Profile management API with validation
  • Phone number validation (E.164 format)

Performance & Caching

  • 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)

Security

  • 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

Modern UI/UX

  • 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

Developer Experience

  • 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

πŸ› οΈ Getting Started

Prerequisites

  • Node.js >= 18
  • pnpm >= 8
  • Docker & Docker Compose (for PostgreSQL and Redis)

Quick Start with Docker

  1. Clone the repository

    git clone https://github.com/YourUsername/station.git
    cd station
  2. Install dependencies

    pnpm install
  3. Start infrastructure services (PostgreSQL & Redis)

    docker-compose up -d

    This starts:

    • PostgreSQL on port 5433
    • Redis on port 6379
  4. Set up environment variables

    The backend/.env file 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
  5. Run database migrations

    cd backend
    pnpm typeorm migration:run -d src/data-source.ts

Development

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 only

Note: Redis is optional. The application will fall back to in-memory caching if Redis is unavailable.

Building for Production

# Build all packages
pnpm build

# Build specific package
cd backend && pnpm build
cd frontend && pnpm build

πŸ“š API Documentation

Once the backend is running, visit:

πŸ§ͺ Testing

# Run all tests
pnpm test

# Backend tests
cd backend
pnpm test          # Unit tests
pnpm test:e2e      # E2E tests
pnpm test:cov      # Coverage report

πŸ“¦ Available Scripts

From root directory:

  • pnpm dev - Run all packages in development mode
  • pnpm build - Build all packages
  • pnpm test - Run tests across all packages
  • pnpm lint - Lint all packages
  • pnpm format - Format code with Prettier
  • pnpm typecheck - Type-check all packages

πŸ” Authentication Flow

  1. Register: POST /auth/register
  2. Login: POST /auth/login β†’ Returns access_token + refresh_token
  3. Access Protected Routes: Include Authorization: Bearer <access_token>
  4. Refresh Token: POST /auth/refresh with Authorization: Bearer <refresh_token>
  5. Logout: POST /auth/logout β†’ Revokes refresh token

πŸ—„οΈ Database Schema

  • 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

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

🀝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests and linting
  5. Submit a pull request

Pre-commit hooks will automatically run linting and formatting.

About

Station is a full-stack application designed as a portal for managing gaming guilds and organizations, complete with member features, secure data management, and robust backend services. It leverages modern cloud technologies for orchestration, scaling, and CI/CD, making it powerful and scalable.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages