A comprehensive NestJS application for veterinary services and pet care management, built with TypeScript, featuring strict type checking, comprehensive linting, and automated code formatting.
PetChain Market is a professional veterinary services platform that provides a complete ecosystem for pet owners, veterinarians, and veterinary staff. The application includes modules for user management, authentication, pet profiles, medical records, emergency services, telemedicine, and shopping cart functionality.
- User Management: Complete user registration and profile management
- Authentication: Secure authentication system for users and staff
- Pet Management: Comprehensive pet profile and information system
- Medical Records: Digital medical record management for pets
- Emergency Services: Emergency veterinary service coordination
- Telemedicine: Remote veterinary consultation platform
- Shopping Cart: Integrated e-commerce for veterinary product
- Staff Management: Veterinary staff and clinic administration
- Customer Pet Portal: Dedicated customer interface for pet management
- NestJS Framework: Modern, scalable Node.js framework
- TypeScript: Strict type checking with enhanced compiler options
- Code Quality: ESLint with strict rules and Prettier formatting
- Testing: Unit and E2E testing with Jest
- Development Experience: Hot reload and debugging support
- Professional Structure: Organized codebase with best practices
Before running this application, ensure you have the following installed:
- Node.js (version 16.x or higher)
- npm (version 7.x or higher)
- Git (for version control)
-
Clone the repository
git clone <repository-url> cd PetChain_market
-
Install dependencies
npm install
-
Verify installation
npm run start:dev
src/
├── app.controller.ts # Main application controller
├── app.controller.spec.ts # Controller unit tests
├── app.module.ts # Root application module
├── app.service.ts # Main application service
├── main.ts # Application entry point
├── user/ # User management module
│ ├── user.controller.ts
│ ├── user.service.ts
│ ├── user.module.ts
│ ├── dto/
│ └── entities/
├── auth/ # Authentication module
│ ├── auth.controller.ts
│ ├── auth.service.ts
│ ├── auth.module.ts
│ ├── dto/
│ └── entities/
├── pet/ # Pet management module
│ ├── pet.controller.ts
│ ├── pet.service.ts
│ ├── pet.module.ts
│ ├── dto/
│ └── entities/
├── medical_record/ # Medical records module
│ ├── medical_record.controller.ts
│ ├── medical_record.service.ts
│ ├── medical_record.module.ts
│ ├── dto/
│ └── entities/
├── shopping_cart/ # Shopping cart module
│ ├── shopping_cart.controller.ts
│ ├── shopping_cart.service.ts
│ ├── shopping_cart.module.ts
│ ├── dto/
│ └── entities/
├── veterinarian/ # Veterinarian services
│ └── staff/ # Staff management module
│ ├── staff.controller.ts
│ ├── staff.service.ts
│ ├── staff.module.ts
│ ├── dto/
│ └── entities/
├── customer/ # Customer services
│ └── pet/ # Customer pet management
│ ├── pet.controller.ts
│ ├── pet.service.ts
│ ├── pet.module.ts
│ ├── dto/
│ └── entities/
├── emergency/ # Emergency services module
│ ├── emergency.controller.ts
│ ├── emergency.service.ts
│ ├── emergency.module.ts
│ ├── dto/
│ └── entities/
└── telemedicine/ # Telemedicine module
├── telemedicine.controller.ts
├── telemedicine.service.ts
├── telemedicine.module.ts
├── dto/
└── entities/
test/
├── app.e2e-spec.ts # End-to-end tests
└── jest-e2e.json # E2E test configuration
Configuration Files:
├── .eslintrc.js # ESLint configuration
├── .gitignore # Git ignore rules
├── .prettierrc # Prettier formatting rules
├── nest-cli.json # NestJS CLI configuration
├── package.json # Project dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── tsconfig.build.json # Build-specific TypeScript config
npm run start:dev- Start development server with hot reloadnpm run start:debug- Start development server with debuggingnpm run start- Start production server
npm run build- Build the application for production
npm run lint- Run ESLint and fix issues automaticallynpm run format- Format code using Prettier
npm run test- Run unit testsnpm run test:watch- Run unit tests in watch modenpm run test:cov- Run tests with coverage reportnpm run test:e2e- Run end-to-end tests
The project uses strict TypeScript settings including:
- Strict null checks
- No implicit any
- Unused variable detection
- Enhanced property checking
- Path mapping for clean imports
Comprehensive linting rules ensure code quality:
- Explicit return types required
- No unused variables
- Strict equality checks
- Import organization
- TypeScript-specific rules
Consistent code formatting with:
- Single quotes
- Trailing commas
- 80 character line width
- 2-space indentation
The application provides comprehensive REST API endpoints organized by modules:
GET /api- Returns welcome messageGET /api/health- Health check endpoint
GET /api/user- Get all usersGET /api/user/:id- Get user by IDPOST /api/user- Create new userPATCH /api/user/:id- Update userDELETE /api/user/:id- Delete user
GET /api/auth- Get authentication statusPOST /api/auth- Authenticate userPATCH /api/auth/:id- Update authenticationDELETE /api/auth/:id- Remove authentication
GET /api/pet- Get all petsGET /api/pet/:id- Get pet by IDPOST /api/pet- Register new petPATCH /api/pet/:id- Update pet informationDELETE /api/pet/:id- Remove pet
GET /api/medical-record- Get all medical recordsGET /api/medical-record/:id- Get medical record by IDPOST /api/medical-record- Create medical recordPATCH /api/medical-record/:id- Update medical recordDELETE /api/medical-record/:id- Delete medical record
GET /api/shopping-cart- Get cart contentsGET /api/shopping-cart/:id- Get cart by IDPOST /api/shopping-cart- Add item to cartPATCH /api/shopping-cart/:id- Update cart itemDELETE /api/shopping-cart/:id- Remove cart item
GET /api/staff- Get all staff membersGET /api/staff/:id- Get staff member by IDPOST /api/staff- Add new staff memberPATCH /api/staff/:id- Update staff informationDELETE /api/staff/:id- Remove staff member
GET /api/customer/pet- Get customer petsGET /api/customer/pet/:id- Get customer pet by IDPOST /api/customer/pet- Register customer petPATCH /api/customer/pet/:id- Update customer petDELETE /api/customer/pet/:id- Remove customer pet
GET /api/emergency- Get emergency casesGET /api/emergency/:id- Get emergency case by IDPOST /api/emergency- Create emergency casePATCH /api/emergency/:id- Update emergency caseDELETE /api/emergency/:id- Close emergency case
GET /api/telemedicine- Get telemedicine sessionsGET /api/telemedicine/:id- Get session by IDPOST /api/telemedicine- Create telemedicine sessionPATCH /api/telemedicine/:id- Update sessionDELETE /api/telemedicine/:id- End session
- Use TypeScript strict mode
- Follow ESLint rules consistently
- Format code with Prettier before committing
- Write comprehensive tests for new features
- Create feature branches from main
- Use conventional commit messages
- Run tests before pushing
- Ensure all linting passes
- Write unit tests for services and controllers
- Create E2E tests for API endpoints
- Maintain test coverage above 80%
- Use descriptive test names
Create a .env file in the root directory for environment-specific configuration:
PORT=3000
NODE_ENV=developmentnpm run build
npm run start:prodFor containerized deployment, create a Dockerfile:
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY dist ./dist
EXPOSE 3000
CMD ["npm", "run", "start:prod"]-
TypeScript compilation errors
- Check tsconfig.json configuration
- Ensure all dependencies are installed
- Verify import paths are correct
-
ESLint errors
- Run
npm run lintto auto-fix issues - Check .eslintrc.js configuration
- Ensure code follows style guidelines
- Run
-
Port already in use
- Change PORT in .env file
- Kill existing processes on port 3000
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
This project is licensed under the UNLICENSED license.
For questions or issues, please refer to the NestJS documentation:
Note: PetChain Market is a comprehensive veterinary services platform designed for professional veterinary practice management, pet care coordination, and telemedicine services with enterprise-grade code quality standards.