TrizyBackend is the backend for Trizy mobile app, a modern e-commerce platform providing personalized shopping experiences, product trials, AI-driven suggestions, and more. This project handles API endpoints, user authentication, product management, and more.
- About
- Tech Stack
- Environment Variables
- Installation
- Running Locally
- Deploying
- API Documentation (Will be added soon)
- License
This backend is built to support the Trizy mobile application, it's providing APIs for features like:
- User authentication and authorization
- Product listing
- Product operations such as liking
- Deal listing
- Category listing
- Cart and order handling
- Review system
- Trial product system
- AI-powered product suggestions
- Analytics
- Node.js: JavaScript runtime
- Express.js: Web framework
- MongoDB: Database
- AWS S3 BUCKET: Image Storage
- NodeCron: For periodic jobs
- Redis: Caching layer
- Stripe API: Payment gateway
- Gemini API: AI
The following environment variables are required to run this project. I will make a Youtube video on how and where to get all of these variables.
Add them to a .env
file in the root directory:
# Database
MONGODB_URI=your_mongodb_connection_string
# AUTH - JWT
SECRET=your_secret_key_for_hashing_passwords
JWT_SEC=your_jwt_secret_key
JWT_REFRESH_SEC=your_jwt_refresh_secret_key
# Stripe
STRIPE_SECRET_KEY=your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret
STRIPE_MONTHYLY_SUBSCRIPTION_PRICE_ID=your_stripe_price_id
# Gemini AI
GEMINI_API_KEY=your_gemini_api_key
# Redis
USE_REDIS=true_or_false
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
Follow these steps to set up the project locally:
-
Clone the repository:
git clone https://github.com/demirelarda/TrizyBackend.git cd TrizyBackend
-
Install dependencies:
npm install
-
Create a
.env
file: Add the required environment variables as listed in the Environment Variables section. -
Run the server:
npm start
The server will be accessible at
http://localhost:5001
.
- Ensure MongoDB and Redis are running on your machine or are accessible via their respective URIs.
- Start the server:
npm start
- You can use tools like Postman or cURL to test the endpoints.
You can deploy to platforms like AWS, Railway, Heroku, or Vercel. Below are deployment instructions for Railway (which is fairly easy to do):
-
Fork and clone the repository:
git clone https://github.com/demirelarda/TrizyBackend.git cd TrizyBackend
-
Push to a new repository: Create your own repository on GitHub and push the code there.
-
Connect to Railway:
- Log in to Railway with GitHub.
- Create a new project and link it to your repository.
-
Set environment variables:
- Go to the "Settings" tab in your Railway project and add the required environment variables as listed in the Environment Variables section.
-
Deploy: Railway will automatically detect your Node.js project and deploy it.
This project is licensed under the MIT License. See the LICENSE file for details.