{"id":21291409,"url":"https://github.com/nadim-nion/first-project","last_synced_at":"2026-04-09T23:13:28.897Z","repository":{"id":263959762,"uuid":"891038956","full_name":"Nadim-Nion/first-project","owner":"Nadim-Nion","description":"A basic backend project built with TypeScript, Mongoose, and Express.js. Implements a modular design for clean code. Features include retrieving all students, fetching a student by ID, and creating new students. Tools: Postman, MongoDB Atlas, and Compass.","archived":false,"fork":false,"pushed_at":"2025-03-08T17:00:51.000Z","size":201,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-08T17:20:01.360Z","etag":null,"topics":["express-js","joi","mongodb-atlas","mongodb-compass","mongoose-schema","postman","typescript","validator-js"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nadim-Nion.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-19T16:09:33.000Z","updated_at":"2025-03-08T17:00:54.000Z","dependencies_parsed_at":"2025-01-13T17:29:36.130Z","dependency_job_id":"8bc9011f-ca80-45b4-8aa6-f6b65e164869","html_url":"https://github.com/Nadim-Nion/first-project","commit_stats":null,"previous_names":["nadim-nion/first-project"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nadim-Nion%2Ffirst-project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nadim-Nion%2Ffirst-project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nadim-Nion%2Ffirst-project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nadim-Nion%2Ffirst-project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nadim-Nion","download_url":"https://codeload.github.com/Nadim-Nion/first-project/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243754761,"owners_count":20342701,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["express-js","joi","mongodb-atlas","mongodb-compass","mongoose-schema","postman","typescript","validator-js"],"created_at":"2024-11-21T13:22:21.052Z","updated_at":"2026-04-09T23:13:28.888Z","avatar_url":"https://github.com/Nadim-Nion.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# First Project with TypeScript, Mongoose, and Express.js\n\nThis is my first project built using **TypeScript**, **Mongoose**, and **Express.js**. The project is a basic backend application that allows you to perform CRUD operations on student data. It implements a **modular design pattern** to keep the codebase clean and organized.\n\n---\n\n## Admin Credentials\n\n```bash\nID: A-0001\nEmail: nion@gmail.com\nPassword: admin123\n```\n\n---\n\n## Features\n\n- **Mongoose Middleware**:\n  - `pre('save')` middleware to hash the password before saving a user document.\n  - `post('save')` middleware to send a notification after a student record is saved.\n- **Virtuals**:\n  - Create a virtual property `fullName` that combines the `firstName` and `lastName` fields.\n- **Custom Validation**:\n\n  - Custom validator for `email` field to ensure it adheres to a specific format (e.g., only accept student emails with domain `@school.com`).\n\n- **Third-Party Validation Library**:\n\n  - Use `Joi` for validating incoming data before saving a new student.\n  - Example: `Joi.object({ name: Joi.string().min(3).required(), email: Joi.string().email().required() })`\n\n- **Custom Instance Method**:\n\n  - Create a method `getStudentProfile()` that returns a student's full profile (including virtual properties like `fullName`).\n\n- **Custom Static Method**:\n  - Implement a static method `findByGrade()` to retrieve all students who belong to a certain grade level.\n\nThese additions enhance the functionality and maintainability of the application while adhering to best practices in validation and data manipulation.\n\n---\n\n## Technologies Used\n\n- **TypeScript**:\n\n  - Provides strong typing to improve code reliability, reduce bugs, and enhance developer experience by enabling type safety and autocompletion.\n\n- **Mongoose**:\n\n  - Provides a seamless and powerful way to interact with MongoDB, allowing for defining schemas, model creation, and middleware integration in a simple and efficient manner.\n\n- **Express.js**:\n\n  - A fast, minimal web framework for building robust backend APIs, offering simplicity, flexibility, and extensive support for routing and middleware.\n\n- **Validator.js**:\n\n  - A library that provides string validation and sanitization, making it easy to validate data (e.g., email, URL, or date formats) before processing or saving it.\n\n- **Joi**:\n\n  - A powerful and flexible schema description and validation library for JavaScript, used to validate incoming request data and ensure it adheres to predefined rules (e.g., required fields, data types, and string lengths).\n\n- **Zod**:\n  - A TypeScript-first schema declaration and validation library that offers a type-safe approach to validate data, providing both runtime validation and compile-time type inference.\n\n---\n\n## Tools Used\n\n- **Postman**: For API testing.\n- **MongoDB Atlas**: For cloud database storage.\n- **MongoDB Compass**: For local database exploration and management.\n\n---\n\n## API Endpoints\n\n| Method | Endpoint                          | Description                 |\n| ------ | --------------------------------- | --------------------------- |\n| GET    | `/api/v1/students/`               | Get all student data        |\n| GET    | `/api/v1/students/:studentId`     | Get specific student by ID  |\n| POST   | `/api/v1/students/create-student` | Create a new student record |\n\n---\n\n## Modular Design\n\nThis project follows a **modular design pattern** to enhance maintainability and scalability. Each module handles specific functionality, making it easier to debug and add features in the future.\n\n---\n\n## Installation and Setup\n\n1. Clone this repository:\n   ```bash\n   git clone https://github.com/your-username/first-project-typescript-mongoose-express.git\n   ```\n2. Navigate to the project directory:\n   ```bash\n   cd first-project-typescript-mongoose-express\n   ```\n3. Install dependencies:\n   ```bash\n   npm install\n   ```\n4. Set up environment variables in a `.env` file:\n   ```\n   PORT=5000\n   DATABASE_URL=\u003cyour-mongodb-atlas-uri\u003e\n   ```\n5. Start the server:\n   ```bash\n   npm run dev\n   ```\n\n---\n\n## Folder Structure\n\n```\nsrc/\n│\n├── controllers/       # Handles business logic\n├── models/            # Mongoose schemas\n├── routes/            # API routes\n├── utils/             # Utility functions\n├── config/            # Configuration files (e.g., database)\n├── middlewares/       # Middleware functions\n├── app.ts             # Main Express application\n├── server.ts          # Server entry point\n```\n\n---\n\n## How to Test\n\n1. Use **Postman** or any API client to test the endpoints.\n2. Ensure MongoDB Atlas or Compass is connected for data storage.\n\n---\n\n## About Me\n\nHi, I am Nadim Mahmud Nion. I have recently concluded my graduation from the department of Computer Science and Engineering (CSE) at the Daffodil International University (DIU). I have been learning MERN Stack Web Development since 2022. I am expertise in the following skills:\n\n- React\n\n- Express.js\n\n- TypeScript\n\n- Mongoose\n\n- Postman\n\n- MongoDB Compass\n\n- NoSQLBooster\n\n- Node.js\n\n- MongoDB Atlas\n\n- JWT\n\n- Stripe\n\n- Vite\n\n- React Router\n\n- Firebase (Authentication \u0026 Hosting)\n\n- Vercel\n\n- JavaScript\n\n- Advanced JavaScript\n\n- Daisy UI\n\n- Bootstrap\n\n- Tailwind\n\n- HTML5\n\n- CSS3\n\n- Media Query\n\nI have built multiple projects using these skills. You are invited to my GitHub profile to know about my projects and don't forget to give a star to my projects.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnadim-nion%2Ffirst-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnadim-nion%2Ffirst-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnadim-nion%2Ffirst-project/lists"}