This project is a backend REST API for an e-commerce platform. It enables sellers to create and manage their own online stores, allowing customers to browse and place orders directly from the stores they prefer. The platform is designed with a focus on empowering individual sellers, offering them tools to manage products, orders, and customer interactions efficiently.
- Java 21
- Spring Boot 3.3.x
- Maven 3.8.x
- PostgreSQL & MongoDB
- Spring Test
- Spring Security & JWT
- Seller Store Management: Sellers can easily set up and customize their own online storefronts.
- Product Catalog: Each seller can create and manage their own product listings.
- Customer Orders: Customers can browse individual stores, place orders, and track order statuses.
- Order Management: Sellers can process and manage orders, including order fulfillment and tracking.
- Authentication & Authorization: Secure authentication for both sellers and customers, with role-based access controls.
This open-source project is for learning and development purposes only. It is not intended for production use or official release.
To run this project, you'll need:
- Java 21 (or any above version)
- Maven 3.8.x or above installed
- PostgreSQL (any Latest version)
- MongoDB (any latest version)
-
Clone the repository:
git clone https://github.com/rajumb0232/E-Stores-API cd E-Stores-API
-
Set up environment variables: Create an
.env
file in the root directory to specify database URL, credentials, etc. You can also use this example file as reference -> .env.example-
MAIL_USERNAME = your-mail-id
- Use any of your Gmail Id that you have used for app password generation.
-
MAIL_PASSWORD = your-app-password
- Use the app password generated in you Google Account.
- [ you can generate app password here https://myaccount.google.com/]
-
POSTGRES_URL = your-PostgreSQL-URL
- Provide the PostgreSQL database server url
-
POSTGRES_USERNAME = your-PostgreSQL-username
- Provide the PostgreSQL database server username
-
POSTGRES_PASSWORD = your-PostgreSQL-password
- Provide the PostgreSQL database server password
-
JWT_SECRET = base-64-encoded-secret
- create a base 64 encode secret and provide here as environmental variable
You can create one using the command
openssl rand -base64 32
-
You can open the project in your favorite IDE (IntelliJIDEA/Eclipse/Spring-Tool-Suite) or run the project in CLI itself. You can use the following instructions to run on CLI directly. Make sure maven is installed and configured within the system.
-
Install dependencies:
mvn clean install
-
Run the application:
mvn spring-boot:run
Once the application is up, it will be running at http://localhost:7000/api/fkv1
by default.
You can customize the port by modifying application.yml
:
server:
port: 7000
base-URL: /api/fkv1/
Swagger UI: http://localhost:7000/swagger-ui.html
Method | Endpoint | Description |
---|---|---|
POST | /sellers/register |
Register a new seller |
POST | /customers/register |
Register a new customer |
POST | /verify-email |
OTP verificatin after registration |
POST | /login |
Login to obtain access token and refresh token |
POST | /logout |
Logout from application |
POST | /refresh |
Issues new access token |
POST | /revoke-other |
Blocks all tokens excluding the current one |
POST | /revoke-all |
Blocks all tokens issued to user |
Find the detailed Documentation through Swagger: http://localhost:7000/swagger-ui.html
(or)
You can also find it in Postman: Postman API
The API returns standard HTTP status codes to indicate success or failure:
- 200 OK: The request was successful
- 400 Bad Request: The request was invalid
- 401 Unauthorized: Authentication failed
- 404 Not Found: Resource not found
- 500 Internal Server Error: Something went wrong on the server
You can also use Postman or any API testing tool to manually test the endpoints.