|
1 | | -# 🔥 bitwise. **v2** |
| 1 | +# Bitwise Server |
2 | 2 |
|
3 | | -<div align="center"> |
| 3 | +[](https://nestjs.com/) |
| 4 | +[](https://www.typescriptlang.org/) |
| 5 | +[](https://www.prisma.io/) |
| 6 | +[](https://www.postgresql.org/) |
4 | 7 |
|
5 | | -**The Phoenix Rises** |
| 8 | +Backend API server for the Bitwise learning platform, built with NestJS and TypeScript. |
6 | 9 |
|
7 | | -*Version 1 was just the beginning. Version 2 is our statement.* |
| 10 | +## Overview |
8 | 11 |
|
9 | | ---- |
| 12 | +Bitwise Server is a RESTful API service that powers the Bitwise educational platform. It provides comprehensive functionality for managing user authentication, lessons, assessments, adaptive learning paths, and user progress tracking. The server leverages AI integration for intelligent content generation and personalized learning experiences. |
10 | 13 |
|
11 | | -[](https://nextjs.org/) |
12 | | -[](https://www.typescriptlang.org/) |
13 | | -[](https://tailwindcss.com/) |
14 | | -[](https://ui.shadcn.com/) |
15 | | -[](https://nestjs.com/) |
| 14 | +## Core Features |
16 | 15 |
|
17 | | -</div> |
| 16 | +- **Authentication & Authorization** - Secure JWT-based authentication with Passport.js |
| 17 | +- **Lesson Management** - CRUD operations for lessons and topics with structured content |
| 18 | +- **Assessment System** - Dynamic assessment generation and evaluation |
| 19 | +- **Adaptive Learning** - AI-powered personalized learning path recommendations |
| 20 | +- **Progress Tracking** - Comprehensive user progress monitoring and analytics |
| 21 | +- **Calculator Tools** - Interactive binary/decimal conversion utilities |
| 22 | +- **Bookmark System** - User content bookmarking functionality |
| 23 | +- **AI Integration** - Integration with Google Gemini and Groq for content generation |
18 | 24 |
|
19 | | -## 🎯 **The Mission** |
| 25 | +## Technology Stack |
20 | 26 |
|
21 | | -When they said no to v1, we didn't retreat. We **evolved**. |
| 27 | +### Core Framework |
| 28 | +- **NestJS** - Progressive Node.js framework for building efficient and scalable server-side applications |
| 29 | +- **TypeScript** - Strongly typed programming language |
| 30 | +- **Fastify** - High-performance web framework |
22 | 31 |
|
23 | | -bitwise v2 isn't just an iteration—it's a complete reimagining of what's possible. Built with cutting-edge technology and an uncompromising vision, this is our answer to those who underestimated our potential. |
| 32 | +### Database & ORM |
| 33 | +- **PostgreSQL** - Primary database |
| 34 | +- **Prisma** - Next-generation ORM for type-safe database access |
| 35 | +- **Supabase** - Backend-as-a-Service for database hosting and authentication |
24 | 36 |
|
25 | | -## ⚡ **Tech Arsenal** |
| 37 | +### AI & Machine Learning |
| 38 | +- **Google Generative AI** - AI SDK for content generation |
| 39 | +- **Groq AI SDK** - AI model integration |
| 40 | +- **Vercel AI SDK** - AI utilities and helpers |
26 | 41 |
|
27 | | -We've assembled the most powerful stack in modern web development: |
| 42 | +### Authentication & Security |
| 43 | +- **Passport.js** - Authentication middleware |
| 44 | +- **JWT** - JSON Web Token implementation |
| 45 | +- **Class Validator** - Validation decorators |
| 46 | +- **Class Transformer** - Object transformation utilities |
28 | 47 |
|
29 | | -### Frontend Powerhouse |
30 | | -- **⚛️ Next.js 14** - The React framework for production |
31 | | -- **🎨 Tailwind CSS** - Utility-first CSS framework |
32 | | -- **🧩 shadcn/ui** - Beautiful, accessible components |
33 | | -- **📱 Responsive Design** - Mobile-first approach |
| 48 | +### Development Tools |
| 49 | +- **ESLint** - Code linting and quality assurance |
| 50 | +- **Prettier** - Code formatting |
| 51 | +- **Jest** - Testing framework |
| 52 | +- **SWC** - Fast TypeScript/JavaScript compiler |
34 | 53 |
|
35 | | -### Backend Excellence |
36 | | -- **🚀 NestJS** - Progressive Node.js framework |
37 | | -- **📝 TypeScript** - Type-safe development |
38 | | -- **🔒 Authentication & Security** - Enterprise-grade protection |
39 | | -- **📊 Database Integration** - Scalable data management |
| 54 | +## Prerequisites |
40 | 55 |
|
41 | | -### Developer Experience |
42 | | -- **🛠️ ESLint & Prettier** - Code quality enforcement |
43 | | -- **🧪 Jest Testing** - Comprehensive test coverage |
44 | | -- **📦 Yarn/NPM** - Package management |
45 | | -- **🔄 Hot Reload** - Lightning-fast development |
| 56 | +Before running the server, ensure you have the following installed: |
46 | 57 |
|
47 | | -## 🚀 **Quick Start** |
| 58 | +- **Node.js** (v18 or higher) |
| 59 | +- **npm** or **yarn** |
| 60 | +- **PostgreSQL** database |
| 61 | +- **Git** |
48 | 62 |
|
49 | | -Get bitwise v2 running in minutes: |
| 63 | +## Getting Started |
50 | 64 |
|
51 | | -```bash |
52 | | -# Clone the revolution |
53 | | -git clone https://github.com/yourorg/bitwise-v2.git |
54 | | -cd bitwise-v2 |
| 65 | +### 1. Clone the Repository |
55 | 66 |
|
56 | | -# Install dependencies |
57 | | -yarn install |
| 67 | +```bash |
| 68 | +git clone <repository-url> |
| 69 | +cd bitwise-server |
| 70 | +``` |
58 | 71 |
|
59 | | -# Fire up development |
60 | | -yarn dev |
| 72 | +### 2. Install Dependencies |
61 | 73 |
|
62 | | -# Watch the magic happen at http://localhost:3000 |
| 74 | +```bash |
| 75 | +npm install |
63 | 76 | ``` |
64 | 77 |
|
65 | | -## 🏗️ **Development** |
| 78 | +### 3. Environment Configuration |
66 | 79 |
|
67 | | -```bash |
68 | | -# Development mode with hot reload |
69 | | -yarn dev |
| 80 | +Create a `.env` file in the root directory with the following variables: |
70 | 81 |
|
71 | | -# Build for production |
72 | | -yarn build |
| 82 | +```env |
| 83 | +# Database |
| 84 | +DATABASE_URL="postgresql://user:password@localhost:5432/bitwise" |
| 85 | +DIRECT_URL="postgresql://user:password@localhost:5432/bitwise" |
73 | 86 |
|
74 | | -# Start production server |
75 | | -yarn start |
| 87 | +# Authentication |
| 88 | +JWT_SECRET="your-secret-key" |
76 | 89 |
|
77 | | -# Run tests |
78 | | -yarn test |
| 90 | +# AI Services |
| 91 | +GOOGLE_AI_API_KEY="your-google-ai-key" |
| 92 | +GROQ_API_KEY="your-groq-api-key" |
79 | 93 |
|
80 | | -# Test with coverage |
81 | | -yarn test:coverage |
| 94 | +# Supabase (optional) |
| 95 | +SUPABASE_URL="your-supabase-url" |
| 96 | +SUPABASE_KEY="your-supabase-key" |
| 97 | +``` |
| 98 | + |
| 99 | +### 4. Database Setup |
82 | 100 |
|
83 | | -# Lint your code |
84 | | -yarn lint |
| 101 | +Generate Prisma client and run migrations: |
85 | 102 |
|
86 | | -# Format your code |
87 | | -yarn format |
| 103 | +```bash |
| 104 | +npm run prisma:generate |
| 105 | +npx prisma migrate dev |
88 | 106 | ``` |
89 | 107 |
|
90 | | -## 🌟 **What Makes v2 Different** |
| 108 | +### 5. Seed Database (Optional) |
| 109 | + |
| 110 | +```bash |
| 111 | +npm run db:seed |
| 112 | +``` |
| 113 | + |
| 114 | +### 6. Run the Development Server |
| 115 | + |
| 116 | +```bash |
| 117 | +npm run start:dev |
| 118 | +``` |
| 119 | + |
| 120 | +The server will start at `http://localhost:3000` (or your configured port). |
| 121 | + |
| 122 | +## Available Scripts |
91 | 123 |
|
92 | | -- **🎯 Purpose-Built** - Every line of code serves the mission |
93 | | -- **🔥 Performance First** - Optimized for speed and efficiency |
94 | | -- **🎨 Design Excellence** - User experience that speaks volumes |
95 | | -- **🛡️ Battle-Tested** - Robust architecture that won't break |
96 | | -- **📈 Scalable** - Ready for whatever comes next |
| 124 | +### Development |
97 | 125 |
|
98 | | -## 🌐 **Deployment** |
| 126 | +```bash |
| 127 | +npm run start:dev # Start development server with watch mode |
| 128 | +npm run start:debug # Start development server in debug mode |
| 129 | +``` |
99 | 130 |
|
100 | | -Ready to show the world what we've built: |
| 131 | +### Production |
101 | 132 |
|
102 | 133 | ```bash |
103 | | -# Deploy to Vercel (Recommended for Next.js) |
104 | | -vercel deploy |
| 134 | +npm run build # Build the application |
| 135 | +npm run start # Start production server |
| 136 | +npm run start:prod # Start production server (alias) |
| 137 | +``` |
105 | 138 |
|
106 | | -# Or build for any platform |
107 | | -yarn build |
| 139 | +### Database |
| 140 | + |
| 141 | +```bash |
| 142 | +npm run prisma:generate # Generate Prisma client |
| 143 | +npm run db:seed # Seed database with initial data |
108 | 144 | ``` |
109 | 145 |
|
110 | | -## 📚 **Documentation** |
| 146 | +### Code Quality |
111 | 147 |
|
112 | | -- [📖 Getting Started Guide](./docs/getting-started.md) |
113 | | -- [🏗️ Architecture Overview](./docs/architecture.md) |
114 | | -- [🎨 Design System](./docs/design-system.md) |
115 | | -- [🔧 API Documentation](./docs/api.md) |
116 | | -- [🚀 Deployment Guide](./docs/deployment.md) |
| 148 | +```bash |
| 149 | +npm run lint # Lint and fix code |
| 150 | +npm run format # Format code with Prettier |
| 151 | +``` |
117 | 152 |
|
118 | | -## 🤝 **Contributing** |
| 153 | +### Testing |
119 | 154 |
|
120 | | -Want to be part of the journey? We welcome contributors who share our vision: |
| 155 | +```bash |
| 156 | +npm run test # Run unit tests |
| 157 | +npm run test:watch # Run tests in watch mode |
| 158 | +npm run test:cov # Run tests with coverage report |
| 159 | +npm run test:debug # Run tests in debug mode |
| 160 | +npm run test:e2e # Run end-to-end tests |
| 161 | +``` |
121 | 162 |
|
122 | | -1. Fork the repository |
123 | | -2. Create your feature branch (`git checkout -b feature/amazing-feature`) |
124 | | -3. Commit your changes (`git commit -m 'Add amazing feature'`) |
125 | | -4. Push to the branch (`git push origin feature/amazing-feature`) |
126 | | -5. Open a Pull Request |
| 163 | +## Project Structure |
127 | 164 |
|
128 | | -## 📄 **License** |
| 165 | +``` |
| 166 | +bitwise-server/ |
| 167 | +├── prisma/ |
| 168 | +│ ├── schema.prisma # Database schema |
| 169 | +│ ├── prisma.module.ts # Prisma module |
| 170 | +│ └── prisma.service.ts # Prisma service |
| 171 | +├── src/ |
| 172 | +│ ├── adaptive/ # Adaptive learning module |
| 173 | +│ ├── assessment/ # Assessment management |
| 174 | +│ ├── auth/ # Authentication & authorization |
| 175 | +│ ├── bookmark/ # Bookmark functionality |
| 176 | +│ ├── calculator/ # Calculator tools |
| 177 | +│ ├── config/ # Configuration files |
| 178 | +│ ├── lessons/ # Lesson management |
| 179 | +│ ├── user/ # User management |
| 180 | +│ ├── user-progress/ # Progress tracking |
| 181 | +│ ├── app.module.ts # Root application module |
| 182 | +│ └── main.ts # Application entry point |
| 183 | +├── test/ # E2E tests |
| 184 | +├── .env # Environment variables |
| 185 | +├── nest-cli.json # NestJS CLI configuration |
| 186 | +├── package.json # Dependencies and scripts |
| 187 | +└── tsconfig.json # TypeScript configuration |
| 188 | +``` |
129 | 189 |
|
130 | | -This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
| 190 | +## API Documentation |
131 | 191 |
|
132 | | -## 🔗 **Connect With Us** |
| 192 | +Once the server is running, API documentation is available at: |
133 | 193 |
|
134 | | -- **🌐 Website**: [bitwise.dev](https://bitwise.dev) |
135 | | -- **📧 Email**: team@bitwise.dev |
136 | | -- **🐦 Twitter**: [@bitwisedev](https://twitter.com/bitwisedev) |
137 | | -- **💼 LinkedIn**: [Bitwise Development](https://linkedin.com/company/bitwise-dev) |
| 194 | +``` |
| 195 | +http://localhost:3000/api/docs |
| 196 | +``` |
138 | 197 |
|
139 | | ---- |
| 198 | +## Environment Variables |
140 | 199 |
|
141 | | -<div align="center"> |
| 200 | +| Variable | Description | Required | |
| 201 | +|----------|-------------|----------| |
| 202 | +| `DATABASE_URL` | PostgreSQL connection string | Yes | |
| 203 | +| `DIRECT_URL` | Direct database connection string | Yes | |
| 204 | +| `JWT_SECRET` | Secret key for JWT token generation | Yes | |
| 205 | +| `GOOGLE_AI_API_KEY` | Google AI API key | Yes | |
| 206 | +| `GROQ_API_KEY` | Groq AI API key | Yes | |
| 207 | +| `SUPABASE_URL` | Supabase project URL | No | |
| 208 | +| `SUPABASE_KEY` | Supabase API key | No | |
142 | 209 |
|
143 | | -**Built with ❤️ and determination** |
| 210 | +## Contributing |
144 | 211 |
|
145 | | -*Version 1 was our foundation. Version 2 is our future.* |
| 212 | +1. Fork the repository |
| 213 | +2. Create a feature branch (`git checkout -b feature/your-feature`) |
| 214 | +3. Commit your changes (`git commit -m 'Add some feature'`) |
| 215 | +4. Push to the branch (`git push origin feature/your-feature`) |
| 216 | +5. Open a Pull Request |
146 | 217 |
|
147 | | -**They doubted us once. They won't make that mistake again.** |
| 218 | +## License |
148 | 219 |
|
149 | | -</div> |
| 220 | +This project is licensed under the UNLICENSED license. |
0 commit comments