In progress...
A simplified Stack Overflow API clone. Implements authentication, user management, posts, cascading comments, and more.
Status: 50 endpoints implemented. (all)
- JavaScript / TypeScript
- Node.js
- Docker Compose
- MySQL & MySQL2
- class-transformer & class-validator
- Sharp
- Multer
- AdminJS
- Nodemailer
- bcrypt
- DOMPurify
- jsdom
- Marked
- Have I Been Pwned API
- Gemini AI API & @google/genai
- JavaScript / TypeScript
- Node.js
- Express.js
- MySQL
- MVC architecture
- No ORM
- Handrolled JWT
- User authentication and registration, refresh tokens
- Post creation, editing, and deletion
- Cascade comments
- Likes and dislikes for posts and comments, which change author's profile rating
- Categories
- Email verification and password reset
- Admin panel (AdminJS)
- File uploads (avatars, post images)
-
- Support for animated avatars
- Input validation and sanitization
- Clone the repository:
git clone https://github.com/pvlvld/Usof-Backend cd Usof-Backend - Install dependencies:
npm install
- Configure environment variables:
- Copy
example.envto.envand set up SMTP and other required variables.
cp example.env .env
- Copy
- Start the database:
(You can modify the schema or seed data in the
./init_scriptsfolder.) (Production: remove./init_scripts/03-seed-example-data.sqlto avoid inserting example data.)To verify the database is running, check that thedocker compose up -d
usof_mysqlcontainer is present and has an "Up" status:docker ps
- Compile TypeScript:
npm run build
- Run the application:
- Development mode (with file watching):
npm run start:dev
- Production mode (PM2 with logs & auto-restart):
npm run start:pm2
- Development mode (with file watching):
- This project is for educational purposes and does not use an ORM.
- If some choices or solutions seem unusual, please check if that's not a requirement from the PDF assignment.
- You might encounter issues when deleting the ./mysql_data folder. If so, use sudo.
- Post images are not finished, but all the logic is ready. It just requires to pick the request structure. Check the uploadImage.middleware.ts
This project is published under ISC license.