I was working on a microservice that allow you to plug & play a comments system anywhere just like Disqus or Facebook comments, but it is a simple example and can be improved to do more than it does.

I called this project (OVER), I built it using express which is a Node.js framework with TypeScript and the database is MySQL without using an ORM .. and its features are:

  • Get comments/replies.
  • Create a comments/replies.
  • Rating.
  • Filter & Paginate the incoming data.

The database has a self-relationship so we can get nested comments (replies) and create them .. like so.


Project Structure

OVER
|--dev // Dev directory.
| |--types // includes TypeScript's local types.
| | |--root.d.ts
|--node_modules // Node modules directory.
|--src // Source directory.
| |--app // App directory.
| | |--Controllers // Includes app's controllers (e.g. HomeController.ts).
| | |--Http // Http directory which includes (middlewares, kernel. router..)
| | | |--Middleware // Place to create and register a middlewares.
| | | |--Kernel.ts // Server's kernel class.
| | | |--Router.ts // An easy router class to work with routes (inspired by Laravel).
| | |--Models // Includes app's models (e.g. Comment.ts).
| | |--Validations // Request's validation.
| | |--helpers.ts // Includes helpers methods to be used elsewhere in the application.
| |--config // Config directory
| | |--app.ts // Application's configurations.
| | |--database.ts // Database's configurations.
| |--database // Database directory
| | |--connection.ts // Database Connection.
| | |--migrations.ts // Database migrations.
| |--routes // Routes directory.
| | |--api.ts // api routes.
| |--server.ts // Server class.
|--.env // environment variables file.
|--.gitignore // gitignore file.
|--nodemon.json // Nodemon configurations.
|--package.json
|--package-lock.json
|--tsconfig.json // Typescript config file.


_________________________
13 directories, 21 files


For more details, I have created a documentation website for this project which explain everything related to this project (APIs, structure, DB, deployment ....)


Enjoy ❤️😁