A modern, production-ready full-stack application with authentication, built using React, TypeScript, Tailwind CSS, Node.js, Express, Prisma, and NeonDB.
- π Authentication System: User registration, login, logout with session management
- ποΈ Database: NeonDB (serverless PostgreSQL) with Prisma ORM
- π¨ Modern UI: React 18, TypeScript, Tailwind CSS v3
- β‘ Fast Development: Vite dev server with HMR
- π§ͺ Testing: Comprehensive test suites (Vitest + Jest)
- π Code Quality: ESLint, TypeScript, automated Git hooks
- π CI/CD: GitHub Actions with automated testing and builds
- Tech Stack
- Project Structure
- Prerequisites
- Quick Start
- Database Setup (NeonDB)
- Development
- Testing
- Deployment
- Code Quality & Git Hooks
- Contributing
- React 18 - Modern React with hooks
- TypeScript - Type safety and better developer experience
- Vite - Lightning-fast build tool and dev server
- Tailwind CSS v3 - Utility-first CSS framework
- React Router - Client-side routing
- Vitest - Testing framework
- Node.js - JavaScript runtime
- Express - Web application framework
- TypeScript - Type safety for backend
- Prisma - Next-generation ORM
- NeonDB - Serverless PostgreSQL database
- Jest - Testing framework
- GitHub Actions - CI/CD pipeline
- Husky - Git hooks for quality gates
- ESLint - Code linting and formatting
- Pre-commit/Pre-push hooks - Automated quality checks
trainee-golems-25t2/
βββ π frontend/ # React application
β βββ π src/
β β βββ π pages/ # Route components (Home, About)
β β βββ π Components/ # Reusable components (Navbar)
β β βββ π test/ # Test files and setup
β β βββ App.tsx # Main app component
β β βββ Router.tsx # Route definitions
β β βββ main.tsx # Entry point
β βββ package.json
β βββ vite.config.ts
β βββ tailwind.config.js
βββ π backend/ # Express API server
β βββ π src/
β β βββ π controllers/ # Request handlers
β β βββ π services/ # Business logic
β β βββ π middleware/ # Express middleware
β β βββ π routes/ # API routes
β β βββ π lib/ # Utilities (Prisma client)
β β βββ π tests/ # Test files
β β βββ server.ts # Express server
β βββ π prisma/
β β βββ schema.prisma # Database schema
β βββ package.json
β βββ .env # Environment variables
βββ π .github/workflows/ # CI/CD configuration
β βββ ci.yml
βββ π .husky/ # Git hooks
β βββ pre-commit
β βββ pre-push
βββ package.json # Root workspace config
βββ README.md
Before you begin, ensure you have the following installed:
- Node.js (v18 or higher) - Download here
- npm (comes with Node.js)
- Git - Download here
- NeonDB Account - Sign up here
git clone https://github.com/devsoc-unsw/trainee-golems-25t2.git
cd trainee-golems-25t2
# Install all dependencies (frontend + backend)
npm run install:all
# Or install individually:
cd frontend && npm install --legacy-peer-deps
cd ../backend && npm install --legacy-peer-deps
Follow the Database Setup section below for detailed NeonDB configuration.
# Start both frontend and backend simultaneously
npm run dev
# Or start individually:
npm run dev:frontend # Frontend at http://localhost:5173
npm run dev:backend # Backend at http://localhost:3001
NeonDB is a serverless PostgreSQL database that's perfect for modern applications. Here's how to set it up:
- Sign up/Login to NeonDB Console
- Click "New Project"
- Configure your project:
- Project name:
trainee-golems-25t2
(or your preference) - Database name:
neondb
(default) - Region: Choose closest to you (e.g.,
US East
,Asia Pacific
)
- Project name:
- Click "Create Project"
- In your NeonDB dashboard, click "Connect"
- Configure connection settings:
- Branch:
main
(default) - Database:
neondb
- Role:
neondb_owner
(default) - Connection pooling: β ENABLED (recommended)
- Branch:
- Copy the connection string - it will look like:
postgresql://neondb_owner:[email protected]/neondb?sslmode=require
-
Navigate to the backend directory:
cd backend
-
Update your
.env
file:# Server Configuration PORT=3001 NODE_ENV=development # NeonDB Database Configuration DATABASE_URL="your_actual_neondb_connection_string_here"
-
Replace
DATABASE_URL
with your actual NeonDB connection string from Step 2.
# Generate Prisma client
npx prisma generate
# Create database tables
npx prisma db push
# (Optional) Open Prisma Studio to view your database
npx prisma studio
# Test the backend server
npm run dev
# You should see: "β
Server running on port 3001"
π Success! Your NeonDB is now connected and ready for development.
The application includes these tables:
- User: Stores user accounts (id, email, name, password, userId)
- Session: Manages user sessions (id, sessionId, userId, timestamps)
npm run install:all # Install all dependencies
npm run dev # Start both frontend and backend
npm run dev:frontend # Start frontend only
npm run dev:backend # Start backend only
npm run test:frontend # Run frontend tests
npm run test:backend # Run backend tests
npm run build:frontend # Build frontend for production
npm run build:backend # Build backend for production
npm run lint:frontend # Lint frontend code
npm run lint:backend # Lint backend code
cd frontend
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run test # Run tests with Vitest
npm run lint # Run ESLint
cd backend
npm run dev # Start development server with hot reload
npm run build # Compile TypeScript to JavaScript
npm run start # Start production server
npm run test # Run tests with Jest
npm run lint # Run ESLint
cd backend
npx prisma generate # Generate Prisma client
npx prisma db push # Sync database with schema
npx prisma studio # Open database GUI
npx prisma migrate dev # Create and apply migrations (optional)
-
Start development servers:
npm run dev
-
Make your changes to frontend or backend code
-
Access your application:
- Frontend: http://localhost:5173
- Backend API: http://localhost:3001
- Database Studio: http://localhost:5555 (if running)
-
Run tests:
npm run test:frontend npm run test:backend
- Framework: Vitest with React Testing Library
- Location:
frontend/src/test/
- Run tests:
npm run test:frontend
- Framework: Jest with Supertest
- Location:
backend/src/tests/
- Run tests:
npm run test:backend
# Frontend coverage
cd frontend && npm run test -- --coverage
# Backend coverage
cd backend && npm run test -- --coverage
The frontend is configured for deployment on platforms like:
- Vercel (recommended)
- Netlify
- GitHub Pages
The backend can be deployed to:
- Railway
- Heroku
- DigitalOcean
- AWS
Make sure to set these in your production environment:
# Backend
DATABASE_URL="your_production_neondb_url"
NODE_ENV="production"
PORT="3001"
This project maintains high code quality through automated checks:
- β ESLint - Code style and quality checks
- β TypeScript - Type checking for frontend and backend
- β Tests - All unit tests must pass
- β Build - Production builds must succeed
The CI pipeline runs on every push and pull request:
- Linting - Code quality checks
- Type Checking - TypeScript validation
- Testing - Comprehensive test suites
- Building - Production build verification
- Security Audit - Dependency vulnerability scanning
Note: Git hooks are automatically installed for all team members after running npm install
!
-
Clone/Fork the repository:
git clone https://github.com/devsoc-unsw/trainee-golems-25t2.git
-
Create a feature branch:
git checkout -b feature/amazing-feature
-
Make your changes and test:
npm run test:frontend npm run test:backend
-
Commit your changes:
git commit -m "feat: add amazing feature" # Pre-commit hooks will run automatically β
-
Push to your branch:
git push origin feature/amazing-feature # Pre-push hooks will run tests and builds β
-
Open a Pull Request
We follow conventional commits for clear and consistent commit messages:
feat:
- New featuresfix:
- Bug fixesdocs:
- Documentation changesstyle:
- Code style changesrefactor:
- Code refactoringtest:
- Adding or updating testschore:
- Maintenance tasks
- Frontend: ESLint + TypeScript + Prettier
- Backend: ESLint + TypeScript
- Formatting: Enforced through pre-commit hooks
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Documentation: Check this README or inline code comments
- NeonDB Docs: NeonDB Documentation
- Prisma Docs: Prisma Documentation
Happy coding! π