This repository contains three separate apps that work together:
backend/– Express + PostgreSQL API server.admin/– React (Vite) admin dashboard.frontend/– React storefront built with Create React App.
The backend now seeds a default admin account for convenience:
- Email:
admin@clothify.com - Password:
Admin@123
After logging in with this account on the storefront, you will be redirected to the admin dashboard.
Follow the steps below if you just pulled the project and want to run everything locally without copying files around manually.
# clone once
git clone https://github.com/hientranc2/DOANKTPM.git
cd DOANKTPM
# or, if you already have a clone, just pull the latest changes
git pull✅ Using
git clone/git pullis the easiest way to get every file at once—no need to download them one by one.
From the repository root run:
# install backend dependencies
npm install --prefix backend
# install admin dependencies
npm install --prefix admin
# install storefront dependencies
npm install --prefix frontendYou only need to reinstall when
package.jsonchanges. Otherwise you can skip this step on subsequent runs.
Open three terminals (or use tools like tmux) and run one command per terminal:
# terminal 1 – API server
npm start --prefix backend # or: node index.js
# terminal 2 – admin dashboard (Vite)
npm run dev --prefix admin
# terminal 3 – storefront (CRA)
npm start --prefix frontendEach application uses its own dev server, so keep the terminals running while you work.
If you prefer a single command, you can use the provided helper script:
./scripts/dev-all.shIt will spawn three background processes (backend, admin, storefront) and tail their output. Press Ctrl+C to stop them all at once.
The script relies only on Bash—no extra Node packages are required.
- The backend expects PostgreSQL connection variables (see
backend/index.js). Create a.envfile inbackend/with PostgreSQL credentials (user, password, host, port, database). - Ensure PostgreSQL is running and the database exists with the required tables schema.
- The frontends read their configuration from their respective
.envfiles if needed (e.g. API base URL).
- Ports already in use – Stop any lingering dev servers or adjust the ports in the respective configuration files.
- Dependency errors – Delete the relevant
node_modules/folder and reinstall withnpm install --prefix <app>. - Accessing the API – By default the backend listens on port
4000. Update the frontends' API URLs if you run the server on a different port.
Happy building!