This project implements the server-side and client-side components of a simple webmail system called MailBag. The application allows users to:
- View available mailboxes
- List messages inside a mailbox
- Read email messages
- Send email messages
- Manage contacts
The system is implemented using a Node.js + Express REST API backend and a React + TypeScript frontend bundled using Webpack.
The backend communicates with external mail servers using IMAP (for reading emails) and SMTP (for sending emails).
This project was tested with the following environment:
Operating System: macOS
Architecture: ARM64 / x86_64
Node.js Version: v22+
Browser: Google Chrome
Package Manager: npm
Server-side:
- Node.js
- Express
- TypeScript
- emailjs-imap-client
- Nodemailer
- NeDB (for contacts storage)
Client-side:
- React
- TypeScript (TSX)
- Webpack
- Axios (AJAX requests)
M6
├ client
│ ├ src
│ ├ dist
│ ├ webpack.config.js
│ └ package.json
│
├ server
│ ├ src
│ ├ dist
│ ├ serverInfo.json
│ └ package.json
│
└ README.md
Clone the repository:
git clone <your-repository-url>
cd M6
Install dependencies for both server and client.
Server:
cd server
npm install
Client:
cd ../client
npm install
From the server directory:
npm run compile
This command:
- Compiles TypeScript files
- Runs the Express server
The server will start on:
http://localhost:3000
From the client directory:
npx webpack
This will bundle the frontend code into:
client/dist/main.js
Then open the client in your browser:
client/dist/index.html
The server API can be tested using curl.
curl localhost:3000/mailboxes
curl localhost:3000/mailboxes/INBOX
curl localhost:3000/messages/INBOX/<message_id>
curl -X DELETE localhost:3000/messages/INBOX/<message_id>
curl localhost:3000/contacts
The server exposes functionality through RESTful APIs, allowing the frontend client to interact with the backend using HTTP requests.
Each resource is mapped to a URL:
/mailboxes
/messages
/contacts
HTTP methods define the operation:
GET → retrieve data
POST → create data
DELETE → remove data
This architecture separates the frontend interface from the backend logic, making the system modular and easier to maintain.
This project demonstrates how multiple web technologies can be integrated to build a functional webmail system:
- Express provides the REST API
- IMAP retrieves emails from the mail server
- SMTP sends emails
- React builds the user interface
- Webpack bundles the frontend application
Together these components form a complete full-stack web application.