A minimalist e-commerce web application built with modern TypeScript and Node.js technologies. This project demonstrates fundamental and advanced concepts in backend development, including user authentication, payment processing, PDF generation, email notifications, and more.
- User authentication and authorization
- Shopping cart management
- Order processing and history
- Payment integration with Stripe
- PDF invoice generation
- Email notifications
- File upload capabilities
- MongoDB session management
- CSRF protection
- Input validation
- Responsive views with EJS templating
- Runtime: Node.js with TypeScript
- Framework: Express.js
- Database: MongoDB with Mongoose ODM
- Template Engine: EJS
- Authentication: bcryptjs
- Session Management: express-session with MongoDB store
- File Handling: Multer
- Email Service: Nodemailer with SendGrid
- Payment Processing: Stripe
- PDF Generation: PDFKit
- Security: CSRF protection, input validation
- Development Tools: Nodemon, TypeScript
Before you begin, ensure you have the following installed:
- Node.js (LTS version recommended)
- MongoDB (local installation or MongoDB Atlas account)
- npm or yarn package manager
-
Clone the repository:
git clone <your-repo-url> cd e-commerce-app
-
Install dependencies:
npm install
-
Create a
.envfile in the root directory with the following variables:MONGODB_URI=your_mongodb_connection_string SESSION_SECRET=your_session_secret STRIPE_KEY=your_stripe_secret_key SENDGRID_API_KEY=your_sendgrid_api_key
-
Start the development server:
npm start
The application will be available at http://localhost:3000 (or your configured port).
src/
├── app.ts # Application entry point
├── controller/ # Route controllers
├── routes/ # Application routes
├── models/ # Database models
├── views/ # EJS templates
├── public/ # Static files
├── utils/ # Utility functions
└── invoices/ # Generated PDF invoices
MONGODB_URI: Your MongoDB connection stringSESSION_SECRET: Secret key for session managementSTRIPE_KEY: Stripe secret key for payment processingSENDGRID_API_KEY: SendGrid API key for email notifications
- Password hashing with bcrypt
- CSRF protection
- Session management
- Input validation
- Secure file uploads
- MongoDB injection prevention
ISC
Elvis Gideon