Full-stack fitness tracking platform built with modern web technologies and Feature-Sliced Design architecture
- Overview
- Architecture
- Technology Stack
- Project Structure
- Getting Started
- Development
- Environment Variables
- Features
- Contributing
SportBase is a comprehensive fitness tracking application that allows users to:
- Track and analyze their athletic activities
- Monitor progress with detailed statistics and charts
- Manage user profiles and settings
- Admin panel for system management
- OAuth integration with Google
- Real-time application status monitoring
The project follows Feature-Sliced Design (FSD) methodology for scalable and maintainable code organization.
src/
βββ app/ # Application initialization & providers
βββ app-pages/ # Page components (business logic)
βββ widgets/ # Composite UI blocks
βββ features/ # User interactions & business features
βββ entities/ # Business entities
βββ shared/ # Reusable resources
- Named exports throughout the codebase (no default exports)
- Path aliases for clean imports (
@/shared,@/features, etc.) - Separation of concerns with clear layer boundaries
- Type safety with TypeScript
- State management with Zustand stores
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- UI Library: React 18
- Styling: Tailwind CSS
- State Management: Zustand
- Data Fetching: Apollo Client (GraphQL)
- Forms: React Hook Form + Yup validation
- Date/Time: Moment.js
- Code Quality: ESLint, Prettier, Husky
- UI Components: Flowbite-inspired design system
- Framework: NestJS
- Language: TypeScript
- API: REST + GraphQL
- Database: MongoDB with Mongoose ODM
- Authentication: JWT + Google OAuth 2.0
- Password Hashing: BcryptJS
- Utilities: Lodash
- Deployment: Kubernetes + AWS
- Code Quality: Husky pre-commit hooks
sportbase/
βββ sportbase-client/ # Frontend application
β βββ app/ # Next.js App Router pages
β β βββ (guest)/ # Guest routes (landing, login)
β β βββ admin/ # Admin panel routes
β β βββ auth/ # Authentication routes
β β βββ activity/ # Activity tracking
β β βββ home/ # User dashboard
β β βββ profile/ # User profile
β β βββ progress/ # Progress analytics
β β βββ settings/ # User settings
β β βββ user/ # User management
β β
β βββ src/ # FSD structure
β β βββ app/ # App layer
β β β βββ providers/ # React providers (Apollo, Auth)
β β β βββ styles/ # Global styles
β β β
β β βββ app-pages/ # Pages layer
β β β βββ activity/ # Activity page logic
β β β βββ admin-apps/ # Admin apps management
β β β βββ admin-users/ # Admin users management
β β β βββ admin-app-issues/ # Admin issues
β β β βββ app-home/ # Home page logic
β β β βββ landing/ # Landing page
β β β βββ profile/ # Profile page
β β β βββ progress/ # Progress analytics
β β β βββ user/ # User page
β β β
β β βββ widgets/ # Widgets layer
β β β βββ latest-monthly-activity/ # Activity widget
β β β βββ layout-header/ # Header component
β β β βββ user-menu/ # User dropdown menu
β β β
β β βββ features/ # Features layer
β β β βββ admin-apps/ # Admin apps management
β β β βββ admin-users/ # Admin users management
β β β βββ admin-app-issues/ # Admin issues management
β β β βββ app-issues/ # User app issues
β β β βββ app-management/ # App CRUD operations
β β β βββ auth/ # Authentication
β β β β βββ login/ # Login feature
β β β β βββ register/ # Registration
β β β β βββ permission/ # Access control
β β β βββ user-profile/ # Profile management
β β β
β β βββ entities/ # Entities layer
β β β βββ activity/ # Activity entity
β β β βββ app/ # Application entity
β β β βββ user/ # User entity
β β β
β β βββ shared/ # Shared layer
β β βββ ui/ # UI components
β β β βββ Badge/
β β β βββ Button/
β β β βββ Dropdown/
β β β βββ Heading/
β β β βββ Input/
β β β βββ Message/ # Toast notifications
β β β βββ Sidepanel/ # Side panels
β β β βββ Spinner/
β β βββ lib/ # Utilities & helpers
β β β βββ apollo/ # GraphQL client
β β β βββ hooks/ # Custom hooks
β β β βββ message/ # Message system
β β β βββ sidepanel/ # Sidepanel system
β β β βββ utils/ # Helper functions
β β βββ types/ # Shared TypeScript types
β β
β βββ public/ # Static assets
β βββ .env # Environment variables
β βββ tsconfig.json # TypeScript config with path aliases
β βββ tailwind.config.ts # Tailwind configuration
β βββ package.json
β
βββ sportbase-server/ # Backend application
βββ src/
β βββ modules/ # Feature modules
β βββ common/ # Shared utilities
β βββ main.ts # Application entry
βββ .env # Environment variables
βββ package.json
- Node.js 18+ and npm
- Docker (for MongoDB)
- MongoDB Compass (recommended)
- Clone the repository
git clone <repository-url>
cd sportbase- Setup Database
# Pull MongoDB Docker image
docker pull mongo
# Run MongoDB container
docker run -d --name mongodb \
-p 27017:27017 \
-e MONGO_INITDB_ROOT_USERNAME=root \
-e MONGO_INITDB_ROOT_PASSWORD=root \
mongo:latest- Setup Backend
cd sportbase-server
npm install
# Create .env file
cat > .env << EOF
MONGO_CONNECTION_STRING=mongodb://root:root@localhost:27017/sportbase?authSource=admin
JWT_SECRET=your-jwt-secret-key
GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-google-client-secret
CLIENT_ORIGIN=http://localhost:3500
GOOGLE_CALLBACK_URL=http://localhost:2500/auth/google/redirect
EOF
# Start server (port 2500)
npm run start:dev- Setup Frontend
cd ../sportbase-client
npm install
# Create .env file
cat > .env << EOF
NEXT_PUBLIC_SERVER_ORIGIN=http://localhost:2500
NEXT_PUBLIC_CLIENT_ORIGIN=http://localhost:3500
NEXT_PUBLIC_GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
CLIENT_ORIGIN=http://localhost:3500
EOF
# Start development server (port 3500)
npm run dev- Access the application
- Frontend: http://localhost:3500
- Backend API: http://localhost:2500
# Development server
npm run dev
# Production build
npm run build
# Start production server
npm start
# Code formatting
npm run format
# Linting
npm run lint
# Type checking
npm run typecheckThe project uses:
- Husky for pre-commit hooks
- Prettier for code formatting
- ESLint for linting (includes Tailwind CSS plugin)
- TypeScript for type checking
All commits are automatically checked for:
- Code formatting
- Linting errors
- Type errors
import { Button } from '@/shared/ui/Button';
import { useAuthStore } from '@/features/auth';
import { ActivityCard } from '@/entities/activity';
import { Header } from '@/widgets/layout-header';
import { ActivityPage } from '@/app-pages/activity';NEXT_PUBLIC_SERVER_ORIGIN=http://localhost:2500
NEXT_PUBLIC_CLIENT_ORIGIN=http://localhost:3500
NEXT_PUBLIC_GOOGLE_CLIENT_ID=<your-client-id>.apps.googleusercontent.com
CLIENT_ORIGIN=http://localhost:3500MONGO_CONNECTION_STRING=mongodb://root:root@localhost:27017/sportbase?authSource=admin
JWT_SECRET=your-jwt-secret-key
GOOGLE_CLIENT_ID=<your-client-id>.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=<your-client-secret>
CLIENT_ORIGIN=http://localhost:3500
GOOGLE_CALLBACK_URL=http://localhost:2500/auth/google/redirect- Authentication: Email/password and Google OAuth
- Activity Tracking: Log and manage fitness activities
- Progress Analytics: Visualize progress with charts and statistics
- Profile Management: Update user information and settings
- Application Management: Create and manage personal applications
- User Management: View and edit user roles
- Application Monitoring: Monitor all applications and their status
- Issue Tracking: View and manage user-reported issues
- Real-time Updates: SSE-based status updates
- Responsive Design: Mobile-first approach with Tailwind CSS
- Type Safety: Full TypeScript coverage
- State Management: Zustand stores with immutable updates
- Real-time Updates: Server-Sent Events (SSE)
- Form Validation: React Hook Form + Yup schemas
- GraphQL Integration: Apollo Client for efficient data fetching
- Permission System: Role-based access control
- Toast Notifications: User feedback system
- Side Panels: Dynamic UI panels for forms
The application uses a custom design system based on Tailwind CSS with:
- Color Palette: Primary (blue), Secondary (gray), Success (green), Error (red)
- Typography: System font stack with responsive sizing
- Components: Buttons, Badges, Inputs, Dropdowns, Spinners, etc.
- Layouts: Container, Grid, Flex utilities
- Responsive: Mobile-first breakpoints (sm, md, lg, xl, 2xl)
# Frontend
npm run typecheck # TypeScript validation
# Backend
npm run test # Unit tests
npm run test:e2e # E2E testsnpm run build
npm startnpm run build
npm run start:prod- Follow the FSD architecture principles
- Use named exports (no default exports)
- Write type-safe TypeScript code
- Follow the existing code style (enforced by Prettier/ESLint)
- Update documentation for new features
- Test your changes before committing
feat: add new feature
fix: bug fix
refactor: code refactoring
docs: documentation updates
style: formatting changes
test: add tests
chore: maintenance tasks[Add your license here]
[Add team information here]