KlasMwen is an educational social platform designed to connect students, promote knowledge sharing, and support collective growth.
- Overview
- Screenshots
- Key Features
- Live Demo
- Tech Stack
- Getting Started
- Architecture Overview
- Real-Time Overview
- API Documentation
- Troubleshooting
- Scripts
- Future Improvements / Roadmap
- AI-Assisted Development & Learning
- License
- Acknowledgements
- Additional Resources
KlasMwen (from Haitian Creole “klas mwen”, meaning “my class”) provides a dedicated digital space for middle and high school students to:
- Ask questions and get help from peers
- Share study notes, tips, and learning resources
- Upload and access educational materials such as PDFs, Excel sheets, and eBooks
It empowers students to learn, share, and grow together in a community built by students, for students.
KlasMwen includes a rich set of features designed to create a safe, collaborative, and student-friendly learning environment.
- Create posts, ask questions, and share study notes
- Comment threads with nested replies
- Markdown support for clean, rich content
- Tag-based categorization and filtering
- Bookmarking and reactions (likes)
- Real-time notifications
- Upload and download files (PDF, DOCX, XLSX, eBooks, images, etc.)
- Cloud storage via Cloudinary
- Automatic file metadata extraction
- JWT-based authentication (http-only cookies)
- Role-Based Access Control (User, Moderator, Admin)
- Secure password handling and session validation
- Avatar selection from a predefined set (DiceBear)
- User reporting system (posts + comments)
- Moderation dashboard for viewing and managing reports
- Content flagging and review flow
- Rate limiting (Express Rate Limit) to stop spamming and abuse
- Validation on every request using Zod
- Structured logging and auditability using Pino
- Server-state caching with TanStack Query
- Optimistic UI updates
- Debounced search and API calls
- Efficient file uploads using Multer + Cloudinary
- Prisma ORM for reliable, type-safe database access
- Fully typed frontend + backend (TypeScript everywhere)
- Swagger/OpenAPI documentation for endpoints
- Vitest tests for frontend and backend
- Monorepo setup with shared tooling
- React 19 – UI library for building dynamic interfaces
- Vite – Modern build tool
- TypeScript – Type-safe JavaScript
- TailwindCSS – Utility-first styling
- shadcn/ui – Accessible, reusable UI components
- TanStack Query (React Query) – Server-state management and caching
- React Hook Form + Zod – Form handling and schema validation
- Axios – HTTP client
- Zustand – Global state management
- Markdown Editor (MDEditor / Markdown Preview) – Content creation
- socket.io-client – Real-time, bidirectional communication
- Node.js + Express 5 – RESTful API framework
- Prisma ORM – Type-safe database access
- Passport.js (JWT & Local) – Authentication and authorization
- Multer – File upload handling
- Cloudinary – Cloud-based media storage
- Pino – Structured logging
- Swagger – API documentation
- Zod – Request/response validation
- Express Rate Limit – Request throttling
- socket.io – Real-time, bidirectional communication
- PostgreSQL – Relational database managed via Prisma ORM
- Vitest + Testing Library – Unit and integration testing
- ESLint + Prettier – Linting and formatting
Ensure you have the following installed:
- Node.js ≥ 18.x.x
- npm or yarn (latest recommended)
- PostgreSQL ≥ 14.x
- Cloudinary account (for media uploads)
- Docker (optional)
💡 Tip: Use nvm to manage Node.js versions easily.
git clone https://github.com/Pdave-dcn/KlasMwen
cd KlasMwencp backend/.env.example backend/.envExample variables:
DATABASE_URL="postgresql://user:password@localhost:5432/klasmwen"
ALLOWED_ORIGIN="http://localhost:5173"
JWT_SECRET="your_jwt_secret"
NODE_ENV="development"
LOG_LEVEL="debug"
CLOUDINARY_CLOUD_NAME="your_cloud_name"
CLOUDINARY_API_KEY="your_api_key"
CLOUDINARY_API_SECRET="your_api_secret"
# Admin credentials (defaults are used only in development)
ADMIN_USERNAME="admin_user"
ADMIN_EMAIL="admin@example.com"
ADMIN_PASSWORD="Admin123"
⚠️ Production Note:When NODE_ENV=production, you must provide real admin values:
- "
ADMIN_USERNAME"- "
ADMIN_EMAIL"- "
ADMIN_PASSWORD"If any of these are missing, the server will fail to start. This ensures a secure admin account is created when seeding the database.
cp frontend/.env.example frontend/.envExample:
VITE_API_BASE_URL="http://localhost:3000/api"
VITE_SOCKET_URL="http://localhost:3000/"npm install
# or
yarn installnpm run db:seednpm run start:frontendnpm run start:backendnpm startMake sure
.envfiles are properly configured.
npm run test --workspace frontendnpm run test --workspace backendnpm run test:ui --workspace frontend
npm run test:ui --workspace backendKlasMwen is a monorepo with frontend, backend, and PostgreSQL database, integrated with Cloudinary.
-
Frontend: React + shadcn UI + TailwindCSS
- UI, routing, forms, markdown editor, state management (Zustand)
- API communication for CRUD, auth, and resources
-
Backend API: Node.js + Express + Prisma ORM
- Business logic, REST endpoints, authentication, file uploads
- Validates requests and interacts with database and Cloudinary
-
Database: PostgreSQL
- Stores users, posts, notes, resources, and metadata
-
External Services: Cloudinary for media, Passport.js for authentication
[User Browser / App]
│
▼
[Frontend (React + shadcn)]
│ API Calls
▼
[Backend (Node.js + Express + Prisma)]
┌─────┴─────┐
▼ ▼
[Database] [Cloudinary]- Posting a Note/Resource: Submit → Frontend → Backend validates → Upload to Cloudinary → Store in DB → Response → Frontend updates UI
- Fetching Resources: Frontend → Backend → Database → Frontend renders
- Authentication: Login → Frontend sends credentials → Backend validates → JWT issued → Frontend stores token
Refer to Architecture Docs for more details.
Authentication state is verified on application startup using /auth/me before protected routes or socket connections are initialized.
KlasMwen uses Socket.IO for authenticated, user-scoped real-time features such as notifications. Socket connections are established only after session verification and are scoped to user-specific rooms. This architecture enables future features like group chats and live collaboration.
- Base URL:
http://localhost:3000/api - Swagger UI:
http://localhost:3000/docs - OpenAPI Spec:
http://localhost:3000/swagger.json
Authentication: Protected endpoints require an
httpOnlyJWT cookie.
| Module | Core Functionality | Example Endpoints |
|---|---|---|
| Auth | Register, login, verify session, logout | POST /auth/register, GET /auth/me |
| Posts | CRUD for posts | GET /posts, POST /posts |
| Comments | CRUD for comments, fetch parent & replies | POST /comments/{postId}, GET /posts/{id}/comments |
| Users | Get & update profiles | GET /users/{id}, PUT /users/{id} |
| Bookmarks | Bookmark/unbookmark posts | GET /users/bookmarks, POST /bookmarks/{postId} |
| Reactions | Like/unlike posts | POST /reactions/{postId} |
| Tags | Fetch tags, admin management | GET /tags/popular, POST /tags (Admin) |
| Avatars | Retrieve & manage avatars | GET /avatars/available, DELETE /avatars/{id} (Admin) |
| Search | Search posts | GET /search/posts |
| Report | Moderation operations | GET /reports, GET /reports/reasons |
| Issue | Possible Cause | Solution |
|---|---|---|
npm run dev fails |
Missing .env variables |
Check .env in frontend & backend |
| Database not seeding | DB not running or unreachable | Start PostgreSQL and run npx prisma db seed |
| Frontend cannot connect | API base URL mismatch | Verify VITE_API_BASE_URL matches backend |
| File uploads fail | Cloudinary keys missing/invalid | Check Cloudinary credentials in backend .env |
| Linting errors | ESLint/Husky misconfigured | Run npm run lint:fix or check lint-staged |
| Script | Purpose |
|---|---|
npm run start:frontend |
Start frontend dev server |
npm run start:backend |
Start backend dev server |
npm start |
Start both servers concurrently |
npm run test |
Run tests (workspace-specific) |
npm run test:ui |
Run interactive test UI |
npm run lint |
Run linter |
npm run db:seed |
Seed the database |
KlasMwen is actively evolving, and several impactful features are planned to elevate collaboration, engagement, and accessibility.
-
Group Chats & Study Circles Create collaborative group spaces for classes, clubs, or focused study groups.
-
Analytics Dashboard Insights for students, moderators, and admins, including:
- Post and engagement metrics
- Activity and learning trends
- Moderation and report statistics
-
Multi-Language Support (i18n) Full internationalization for a more accessible experience, starting with:
- French
- Haitian Creole
- Quiz creation
- Scheduled study sessions
- AI-powered note summarization and question assistance
- Peer tutoring sessions via video or chat
- Integrations with platforms like Google Classroom or Moodle
- Mobile app (React Native / Expo)
This project was developed with the assistance of AI tools as both a productivity aid and a learning companion.
As a junior developer, this was my largest and most complex project to date. AI played an important role in helping me understand new concepts, evaluate design decisions, and improve code quality, while all architectural choices and final implementations remained my responsibility.
- Learning and understanding backend architecture patterns (e.g. thin controllers, service layers, CQRS-style separation)
- Exploring best practices for logging (Pino), error handling, and structured APIs
- Understanding and implementing OpenAPI / Swagger documentation
- Receiving suggestions for refactoring files and improving structure and readability
- Generating initial UI boilerplate (e.g. layouts, components, pages) that was then heavily refactored or rewritten
- Acting as a “rubber duck” to reason through edge cases and trade-offs
- Choosing which architectural patterns to adopt and applying them consistently
- Designing business logic, data models, and authorization rules
- Refactoring or discarding AI-generated code that did not meet project standards
- Enforcing type safety, validation, and error handling across frontend and backend
- Integrating real-time features (Socket.IO) into an existing authenticated system
- End-to-end testing of core user flows
- Manual testing of authentication, permissions, and real-time notifications
- Schema validation on both client and server
- Iterative refactoring as understanding improved throughout the project
This project reflects growth through iteration — AI helped accelerate learning, but the architecture, decisions, and final system are the result of hands-on engineering and continuous refinement.
This project is licensed under the terms in the LICENSE file.
Thanks to the communities behind React, TailwindCSS, shadcn, Node.js, Express, Prisma, PostgreSQL, Cloudinary, Vitest, ESLint, and other free and open-source tools.




