Node.js/Express backend API with MySQL database.
- Install dependencies:
npm install- Create a
.envfile in the backend directory:
PORT=3001
NODE_ENV=development
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=your_password
DB_NAME=buildtrust
JWT_SECRET=your_super_secret_jwt_key_change_this_in_production
JWT_EXPIRES_IN=7d
FRONTEND_URL=http://localhost:8080- Create the MySQL database:
CREATE DATABASE buildtrust;- Run the server:
npm run devThe server will automatically create the required tables on first run.
A default super admin account is automatically created during database initialization if it doesn't already exist:
Login Credentials:
- Email:
admin@gmail.com - Password:
12345
Important: Change these credentials immediately in a production environment for security reasons.
POST /api/auth/signup- Create a new accountPOST /api/auth/login- Sign inGET /api/auth/me- Get current userPOST /api/auth/logout- Sign out
GET /api/health- Check API status
id(INT, PRIMARY KEY, AUTO_INCREMENT)email(VARCHAR(255), UNIQUE, NOT NULL)password(VARCHAR(255), NOT NULL)name(VARCHAR(255))role(ENUM('client', 'developer'), DEFAULT 'client')created_at(TIMESTAMP)updated_at(TIMESTAMP)
id(INT, PRIMARY KEY, AUTO_INCREMENT)user_id(INT, FOREIGN KEY)token(VARCHAR(500), NOT NULL)expires_at(TIMESTAMP, NOT NULL)created_at(TIMESTAMP)