An e-commerce web application for buying and selling books online.
- Node.js 16.x or higher
- npm 8.x or higher
- Microsoft SQL Server 2016 or higher
- Clone the repository
git clone https://github.com/lilkhoa/book-worm.git
cd book-worm- Install dependencies
npm install- Set up environment variables
Create a .env file in the root directory (use .env.example as a template):
APP_NAME=Book Worm
APP_URL=http://localhost:3000
PORT=3000
NODE_ENV=development
SESSION_SECRET=your-super-secret-session-key-change-in-production
DB_SERVER=localhost
DB_DATABASE=BookWormDB
DB_USER=your_username
DB_PASSWORD=your_password
DB_ENCRYPT=true
DB_TRUST_CERT=true- Set up the database
Run these files in the correct order using SQL Server Management Studio or any SQL client:
database_setup.sqltrigger.sqlinsert-data.sqlfunctions-and-procedures.sql
- Test database connection (optional)
node test_db_connection.js- Start the server
npm start- In a separate terminal, watch for SCSS changes
npm run watch- Access the application
Open your browser and navigate to: http://localhost:3000
npm start- Start the Node.js server with nodemonnpm run watch- Watch and compile SCSS filesnpm run build:scss- Build SCSS files once
book-worm/
├── src/
│ ├── app/
│ │ ├── controllers/ # Request handlers
│ │ ├── models/ # Database models
│ │ └── middlewares/ # Custom middleware
│ ├── config/ # Configuration files
│ ├── public/ # Static files (CSS, images)
│ ├── resources/
│ │ ├── scss/ # SCSS source files
│ │ └── views/ # Handlebars templates
│ ├── routes/ # Route definitions
│ └── utils/ # Utility functions
├── database_setup.sql # Database schema and sample data
└── package.json
- Browse and search books
- User authentication (login/register)
- Shopping cart
- Category filtering
- Responsive design
- Vietnamese language support
- Backend: Node.js, Express.js
- Database: Microsoft SQL Server
- Template Engine: Handlebars
- Styling: Bootstrap 5, SCSS
- Session Management: express-session
- Authentication: bcryptjs
ISC