This project serves as the backend for Aoushadhi, an ecommerce platform specializing in medicinal products. It provides APIs for user management, product listings, orders, payments, and more.
Make sure to set up the following environment variables:
PORT
: Port number for the serverMONGODB_URI
: URI for MongoDB database connectionCORS_ORIGIN
: Allowed origin for CORSACCESS_TOKEN_SECRET
: Secret key for generating access tokensACCESS_TOKEN_EXPIRY
: Expiry duration for access tokensREFRRESH_TOKEN_SECRET
: Secret key for generating refresh tokensREFRRESH_TOKEN_EXPIRY
: Expiry duration for refresh tokensSTRIPE_PUBLISH_KEY
: Stripe publishable key (for payments)STRIPE_SECRET_KEY
: Stripe secret key (for payments)
src/
├── controllers/
│ ├── order.controller.js
│ ├── payment.controller.js
│ ├── product.controller.js
│ └── user.controller.js
├── db/
│ └── index.js
├── middlewares/
│ ├── auth.middleware.js
│ └── error.middleware.js
├── models/
│ ├── order.model.js
│ ├── product.model.js
│ └── user.model.js
├── routes/
│ ├── order.routes.js
│ ├── payment.routes.js
│ ├── product.routes.js
│ └── user.routes.js
├── utils/
│ ├── ApiError.js
│ ├── ApiResponse.js
│ └── asyncHandler.js
├── app.js
├── constants.js
├── index.js
├── .env
├── .env.example
├── .vscode/
├── node_modules/
└── README.md
dev
: Starts the server using nodemon with dotenv configurationstart
: Starts the server using Node.js
bcrypt
: Password hashing librarybcryptjs
: Alternative password hashing librarycookie-parser
: Middleware for parsing cookiescors
: Cross-Origin Resource Sharing middlewaredotenv
: Loads environment variables from.env
fileexpress
: Web framework for Node.jsjsonwebtoken
: Library for generating JSON Web Tokens (JWT)mongoose
: MongoDB object modeling toolrazorpay
: Razorpay SDK for payment integrationstripe
: Stripe SDK for payment integration
{
"singleQuote": false,
"bracketSpacing": true,
"tabWidth": 2,
"semi": true,
"trailingComma": "es5"
}
- Clone the repository.
- Navigate to the
src
folder. - Install dependencies using
npm install
. - Create a
.env
file in thesrc
folder and add necessary environment variables. - Start the server using
npm run dev
for development ornpm start
for production.
Contributions are welcome. Please follow GitHub Flow when making contributions.