This is the NodeJS, Express, and MongoDB based backend of the Headless-CMS Project. It has all the schemas, routes, and controllers for the backend.
This project is the backend service for a Headless CMS, designed to manage blog content. It is built with NodeJS, Express, and MongoDB.
To set up the project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/HattySohaib/Headless-CMS-Backend.git
-
Change into the project directory:
cd Headless-CMS-Backend
-
Install the dependencies:
npm install
-
Create a
.env
file in the root directory and add your environment variables:PORT=3000 MONGODB_URI=your-mongodb-uri JWT_SECRET=your-jwt-secret AWS_ACCESS_KEY_ID=your-aws-access-key-id AWS_SECRET_ACCESS_KEY=your-aws-secret-access-key S3_BUCKET_NAME=your-s3-bucket-name
To run the project:
npm start
This will start the server using nodemon
on the port specified in the .env
file.
start
: Runs the application withnodemon
.
- @aws-sdk/client-s3: AWS SDK for S3.
- @aws-sdk/s3-request-presigner: AWS SDK for S3 request presigner.
- bcrypt: Library for hashing passwords.
- cors: Middleware for enabling CORS.
- dotenv: Loads environment variables from a
.env
file. - express: Web framework for Node.js.
- jsonwebtoken: Library for working with JSON Web Tokens.
- mongodb: MongoDB driver for Node.js.
- mongoose: MongoDB object modeling tool.
- multer: Middleware for handling
multipart/form-data
(file uploads).
The following environment variables are required to run the project:
PORT
: The port on which the server will run.MONGODB_URI
: The URI for connecting to MongoDB.JWT_SECRET
: Secret key for signing JSON Web Tokens.AWS_ACCESS_KEY_ID
: AWS access key ID.AWS_SECRET_ACCESS_KEY
: AWS secret access key.S3_BUCKET_NAME
: Name of the S3 bucket.
This project is licensed under the ISC License.