Skip to content

Latest commit

 

History

History
171 lines (136 loc) · 4.57 KB

File metadata and controls

171 lines (136 loc) · 4.57 KB

AADE Setup Guide

Project Structure Created

authSystem/
├── src/
│   ├── services/       # Business logic services (empty, ready for task 2+)
│   ├── models/         # Data models (empty, ready for task 2)
│   ├── controllers/    # API controllers (empty, ready for task 12)
│   ├── middleware/     # Express middleware (empty, ready for task 11)
│   ├── utils/          # Utility functions (empty, ready for task 2+)
│   ├── types/          # TypeScript types (empty, ready for task 2)
│   ├── config/         # Configuration (empty, ready for task 2)
│   ├── index.ts        # Application entry point
│   └── index.test.ts   # Health check test
├── dist/               # Build output (generated)
├── node_modules/       # Dependencies (installed)
├── .env.example        # Environment variable template
├── .eslintrc.json      # ESLint configuration
├── .gitignore          # Git ignore rules
├── .prettierrc.json    # Prettier configuration
├── jest.config.js      # Jest test configuration
├── package.json        # Project dependencies and scripts
├── README.md           # Project documentation
└── tsconfig.json       # TypeScript configuration

Dependencies Installed

Production Dependencies

  • express (4.18.2) - Web framework
  • jsonwebtoken (9.0.2) - JWT token generation/validation
  • argon2 (0.31.2) - Password hashing
  • pg (8.11.3) - PostgreSQL client
  • redis (4.6.12) - Redis client for caching
  • dotenv (16.3.1) - Environment variable management
  • cors (2.8.5) - CORS middleware
  • helmet (7.1.0) - Security headers
  • express-rate-limit (7.1.5) - Rate limiting
  • express-validator (7.0.1) - Input validation
  • winston (3.11.0) - Logging
  • speakeasy (2.0.0) - TOTP/MFA support

Development Dependencies

  • typescript (5.3.3) - TypeScript compiler
  • ts-node (10.9.2) - TypeScript execution
  • ts-node-dev (2.0.0) - Development server with hot reload
  • jest (29.7.0) - Testing framework
  • ts-jest (29.1.1) - Jest TypeScript support
  • fast-check (3.15.0) - Property-based testing
  • supertest (6.3.3) - HTTP testing
  • eslint (8.56.0) - Code linting
  • prettier (3.1.1) - Code formatting
  • cross-env (7.0.3) - Cross-platform environment variables

Configuration Files

TypeScript (tsconfig.json)

  • Target: ES2022
  • Strict mode enabled
  • Source maps enabled
  • Output directory: ./dist

ESLint (.eslintrc.json)

  • TypeScript parser
  • Recommended rules
  • Prettier integration
  • Strict type checking

Jest (jest.config.js)

  • ts-jest preset
  • Coverage threshold: 80%
  • Test environment: node

Prettier (.prettierrc.json)

  • Single quotes
  • 2-space indentation
  • 100 character line width
  • Semicolons enabled

Available Scripts

# Development
npm run dev          # Start development server with hot reload

# Building
npm run build        # Compile TypeScript to JavaScript

# Production
npm start            # Start production server

# Testing
npm test             # Run all tests
npm run test:watch   # Run tests in watch mode
npm run test:coverage # Run tests with coverage report

# Code Quality
npm run lint         # Check code for linting errors
npm run lint:fix     # Fix linting errors automatically
npm run format       # Format code with Prettier
npm run format:check # Check code formatting

Environment Variables

Copy .env.example to .env and configure:

# Server
NODE_ENV=development
PORT=3000

# Database (PostgreSQL)
DB_HOST=localhost
DB_PORT=5432
DB_NAME=aade_db
DB_USER=postgres
DB_PASSWORD=your_password

# Redis
REDIS_HOST=localhost
REDIS_PORT=6379

# JWT Secrets (generate secure random strings)
JWT_ACCESS_SECRET=your_secret_here
JWT_REFRESH_SECRET=your_secret_here

# Security
BCRYPT_ROUNDS=12
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100

Next Steps

Task 1 is complete! You can now proceed to:

Task 2: Implement core data models and database schema

  • Create TypeScript interfaces
  • Write database migrations
  • Set up database connection

Verification

Run these commands to verify the setup:

# Check linting
npm run lint

# Check build
npm run build

# Run tests
npm test

# Check formatting
npm run format:check

All commands should complete successfully.

Notes

  • The server runs on port 3000 by default (configurable via PORT env var)
  • Health check endpoint available at GET /health
  • TypeScript strict mode is enabled for maximum type safety
  • Code coverage target is set to 80%
  • All tests pass successfully