A full-stack educational card game built with React, TypeScript, Node.js, Express, and Prisma.
This is a monorepo with the following structure:
timeline_game/
├── frontend/ # React + TypeScript frontend
├── backend/ # Node.js + Express + Prisma backend
├── docs/ # Project documentation
└── package.json # Root workspace configuration
- Node.js 18+
- Yarn package manager
- PostgreSQL 14+ (for backend)
- Redis 6+ (for backend caching)
-
Install all dependencies:
yarn install:all
-
Set up environment variables:
# Backend environment cd backend cp env.example .env # Edit .env with your database and Redis credentials
-
Set up database:
cd backend npx prisma migrate dev npx prisma db seed
Run both frontend and backend simultaneously:
yarn devThis will start:
- Frontend: http://localhost:3000
- Backend: http://localhost:3001
Run individually:
# Frontend only
yarn dev:frontend
# Backend only
yarn dev:backendRun all tests:
yarn testRun with coverage:
yarn test:coverageRun individually:
# Frontend tests
yarn test:frontend
# Backend tests
yarn test:backendBuild both applications:
yarn buildBuild individually:
# Frontend build
yarn build:frontend
# Backend build
yarn build:backendLint all code:
yarn lintFix linting issues:
yarn lint:fix| Command | Description |
|---|---|
yarn dev |
Start both frontend and backend in development mode |
yarn build |
Build both applications for production |
yarn test |
Run all tests |
yarn test:coverage |
Run all tests with coverage reports |
yarn lint |
Lint all code |
yarn lint:fix |
Fix linting issues |
yarn clean |
Clean all build artifacts and node_modules |
yarn start |
Start both applications in production mode |
| Command | Description |
|---|---|
yarn dev:frontend |
Start frontend development server |
yarn dev:backend |
Start backend development server |
yarn build:frontend |
Build frontend for production |
yarn build:backend |
Build backend for production |
yarn test:frontend |
Run frontend tests |
yarn test:backend |
Run backend tests |
-
Start development servers:
yarn dev
-
Make changes to frontend (React/TypeScript) or backend (Node.js/Express)
-
Run tests to ensure everything works:
yarn test -
Check linting:
yarn lint
-
Build for production:
yarn build
The backend provides the following API endpoints:
POST /api/games- Create a new gamePOST /api/games/join- Join an existing gameGET /api/games/:roomCode- Get game by room code
GET /health- Server health status
The application uses PostgreSQL with Prisma ORM. The database schema includes:
- Game: Game sessions and state
- Player: Game participants
- Card: Historical event cards
- TimelineCard: Placed cards in timeline
- Frontend: Vitest + React Testing Library
- Backend: Jest + Supertest
- Coverage: Both packages generate coverage reports
See the docs/ directory for detailed documentation:
- Follow TypeScript best practices
- Write tests for new features
- Use ESLint for code quality
- Follow the established project structure
- Update documentation as needed
MIT