Store Builder App is a backend application designed to support a store building platform similar to Shopify. The backend provides APIs for user registration and login, creating a unique directory for each user upon signup, and handling authentication with JWT tokens. The project is built using Node.js, Express.js, and MySQL.
- User Registration: Sign up new users and create a unique directory for each user.
- User Login: Authenticate users and provide a JWT token for authorization.
- File Management: Unzip a pre-existing file into the user's directory upon signup.
The project is organized into the following structure:
store-builder-backend/
│
│
├── users/
│ ├── user_site_name/
│ └── ...
│
│
├── .env
├── .gitignore
├── package.json
├── app.http
├── README.md
├── index.js
├── wordpress.zip
└── ...
- Node.js (>= v20.13.1)
- npm (>= 10.5.2)
- MySQL
-
Clone the repository:
git clone https://github.com/zishanverse/store-builder-backend.git cd store-builder-backend
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory with the following environment variables:PORT=4000 MYSQLDATABASE=database_name MYSQLHOST=host_name MYSQLPASSWORD=password MYSQLPORT=port_no MYSQLUSER=user_name
To start the development server, run:
npm start
The server will start on http://localhost:4000.
-
User Signup
- Endpoint:
POST /api/signup
- Description: Registers a new user, creates a unique directory, and unzips the template file into it.
- Request Body:
{ "email_phone": "string", "password": "string", "created_at": "date", "site_name": "string", "category": "string"}
- Response:
{ "email_phone": "string", "password": "string", "created_at": "date", "site_name": "string", "category": "string"}
- Endpoint:
-
User Login
- Endpoint:
POST /login/
- Description: Authenticates a user and returns a JWT token and user data.
- Request Body:
{ "username": "string", "password": "string" }
- Response:
{ "jwtToken": "string", "user": { "email_phone": "string", "password": "string", "created_at": "date", "site_name": "string", "category": "string"} } }
- Endpoint:
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to reach out if you have any questions or need further assistance.
Happy coding!