A full-stack e-commerce application built with Angular 12 frontend and Node.js backend, featuring comprehensive admin management capabilities.
- Node.js (v14 or higher)
- npm (v6 or higher)
- Angular CLI (v12 or higher)
-
Clone the repository (if not already done):
git clone <repository-url> cd audiophile-app
-
Install Frontend Dependencies:
npm install
-
Install Backend Dependencies:
cd backend npm install cd ..
# Terminal 1 - Start Backend
cd backend
node server.jsExpected Output:
Server running on port 3000
Health check: http://localhost:3000/api/health
API root: http://localhost:3000/api
Default admin user: admin / admin1234
# Terminal 2 - Start Frontend
ng serve --port 4200Expected Output:
β Browser application bundle generation complete.
** Angular Live Development Server is listening on localhost:4200
If you have the start-dev.sh script:
chmod +x start-dev.sh
./start-dev.sh- Main App: http://localhost:4200
- Admin Dashboard: http://localhost:4200/admin/login
- API Root: http://localhost:3000/api
- Health Check: http://localhost:3000/api/health
- API Documentation: See
API_Documentation.md
- Username:
admin - Password:
admin1234 - Role: Administrator
- Browse products by category
- View product details
- Shopping cart functionality
- Order management
- User authentication
- Product Management: Create, read, update, delete products
- Category Management: Manage product categories
- Order Management: View and update order statuses
- User Management: Admin user authentication
# Health check
curl http://localhost:3000/api/health
# Get all products
curl http://localhost:3000/api/products
# Admin login
curl -X POST http://localhost:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"admin1234"}'- Open http://localhost:4200 in your browser
- Navigate to http://localhost:4200/admin/login
- Login with admin credentials
- Test admin dashboard features
- Import
Audiophile_API_Postman_Collection.jsoninto Postman - Set collection variables:
base_url: http://localhost:3000
- Start with "Health Check" request
- Run "Login" request to get tokens
- Test other endpoints
audiophile-app/
βββ src/ # Angular frontend
β βββ app/
β β βββ modules/
β β β βββ admin/ # Admin dashboard
β β β βββ main/ # Main app
β β β βββ authenticate/ # Authentication
β β βββ services/ # API services
β β βββ guards/ # Route guards
β βββ assets/ # Static assets
βββ backend/ # Node.js backend
β βββ server.js # Main server file
β βββ package.json
βββ Audiophile_API_Postman_Collection.json
βββ API_Documentation.md
βββ README.md
The backend uses in-memory storage for simplicity. Key configurations:
- Port: 3000
- JWT Secret:
your-secret-key - Token Expiry: 15 minutes (access), 7 days (refresh)
- Port: 4200
- API URL: http://localhost:3000/api
- Angular Version: 12.2.18
# Kill processes on ports 3000 and 4200
sudo lsof -ti:3000 | xargs kill -9
sudo lsof -ti:4200 | xargs kill -9# Reinstall Angular Material
npm install @angular/material@12.2.13# Check if dependencies are installed
cd backend
npm install
node server.js# Clear Angular cache
rm -rf node_modules/.cache
ng serve --port 4200# Check if servers are running
ps aux | grep -E "(ng serve|node.*server)" | grep -v grepFor detailed API documentation, see:
- Postman Collection:
Audiophile_API_Postman_Collection.json - API Documentation:
API_Documentation.md
- Backend:
node server.js(in-memory storage) - Frontend:
ng serve(development server)
- Backend: Use PM2 or Docker
- Frontend:
ng build --prod - Database: Replace in-memory with persistent storage
If you encounter any issues:
- Check the troubleshooting section above
- Verify all dependencies are installed
- Ensure both servers are running
- Check browser console for errors
- Test all features using the admin dashboard
- Explore the API using Postman collection
- Customize the application as needed
- Add more features like user registration, payment processing, etc.
Happy Coding! π