A Backend API implementation of social media application with the ability to authenticate users and create posts with image and without images
Typescript
Express
Cloudinary
MongoDB
Turbo mono repo
Jest
JWT
SocketIO
Redis
Bull messaging queue
Eslint
andPrettier
Bunyan logger
git clone the repo
cd apps/server and yarn install
- this will install all the dependenciescreate .env file and fill with data from .env.example
- in the root folder
yarn dev
this will spin up the server on PORT5175
Before this make sure you have REDIS
and MONGODB
up and running
yarn build
- this will build the server from typescript to javascriptyarn test
- this will run all the tests for users and postsyarn dev
- runs the server in development mode with nodemon watcheryarn lint
- checks for linting errorsyarn lint:fix
- fix the lint errorsyarn redis:ui
- runs redis-commander ui so that all redis keys can be seen on UIprettier:check
- checks for formatting issuesprettier:fix
- fixes the formatting issues
The folder stucture of the application is standard, there is a folder corresponding to each feature and has the following things inside
controllers
- controllers for the endpointsinterfaces
- interfaces of the feature is defined heremodels
- mongodb models are placed here for IO to mongodbschemes
- validation for requests coming to backend viaJoi
routes
- routes for the feature that are used inside the application for the particular feature
Apart from that Shared
folder contains the frequently used or shared code that is being used by multiple features
globals
decorators
- contains decorators for request validationhelpers
- container codes for middlerwares and other helper functions example custom errors etc
services
db
- contains implementation of calls to mongodbservices
- contains the implementation of various services need by auth and post controllersemail
- contains implementation of MailTransporter classqueues
- contains code related to various queues (auth,user,post) etcredis
- contains implementation of redis cache implementation
workers
- contains code for workers that utilises and processed data in the queue
The Data of the queue is also accesible by Bull Dashboard
on endpoint localhost:5175/queues
Made with ❤️ using Typescript