A simplified Customer Relationship Management (CRM) application built with the MERN stack (modernized with TypeScript, Vite, and Prisma).
This project follows a monorepo structure with separate frontend and backend applications:
- Frontend: React 19 + TypeScript + Vite + Tailwind CSS
- Backend: Node.js 22 + Express 5 + TypeScript + Prisma
- Node.js >= 22.0.0
- npm >= 10.0.0
git clone <repository-url>
cd p7-dfsjscd server
npm installcp .env.example .envEdit .env if needed (default values should work for local development).
npx prisma generate
npx prisma migrate dev --name initcd ../client
npm installcp .env.example .envcd server
npm run devThe API will be available at http://localhost:8080
In a new terminal:
cd client
npm run devThe application will be available at http://localhost:4200
npm run dev- Start development server with hot reloadnpm run build- Build for productionnpm start- Start production servernpm test- Run testsnpm run lint- Lint codenpm run prisma:generate- Generate Prisma clientnpm run prisma:migrate- Run database migrationsnpm run prisma:studio- Open Prisma Studio (database GUI)
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm test- Run testsnpm run lint- Lint code
p7-dfsjs-starter/
├── client/ # Frontend React application
│ ├── src/
│ │ ├── components/ # Reusable React components
│ │ ├── pages/ # Page components
│ │ ├── hooks/ # Custom React hooks
│ │ ├── services/ # API client services
│ │ ├── types/ # TypeScript type definitions
│ │ ├── App.tsx # Main App component
│ │ └── main.tsx # Application entry point
│ ├── public/
│ ├── index.html
│ ├── package.json
│ ├── vite.config.ts
│ └── Dockerfile
├── server/ # Backend Express application
│ ├── src/
│ │ ├── controllers/ # Route handlers (HTTP layer)
│ │ ├── services/ # Business logic layer
│ │ ├── repositories/ # Data access layer
│ │ ├── models/ # Data models and schemas
│ │ ├── routes/ # API route definitions
│ │ └── index.ts # Server entry point
│ ├── prisma/
│ │ └── schema.prisma # Database schema
│ ├── package.json
│ ├── tsconfig.json
│ └── Dockerfile
└── README.md
- Dashboard: View statistics and overview
- Contacts Management: Create, read, update, and delete contacts
- Organizations Management: Manage companies and link them to contacts
- RESTful API: Well-structured backend with Controller-Service-Repository pattern
- Type Safety: Full TypeScript support on frontend and backend
- Modern UI: Tailwind CSS with responsive design
GET /api/organizations- Get all organizationsGET /api/organizations/:id- Get organization by IDPOST /api/organizations- Create new organizationPUT /api/organizations/:id- Update organizationDELETE /api/organizations/:id- Delete organizationGET /api/organizations/stats- Get organization statistics
GET /api/contacts- Get all contactsGET /api/contacts/:id- Get contact by IDPOST /api/contacts- Create new contactPUT /api/contacts/:id- Update contactDELETE /api/contacts/:id- Delete contactGET /api/contacts/stats- Get contact statistics
- React 19: Modern React with Hooks
- TypeScript 5.x: Static typing
- Vite: Fast build tool
- Tailwind CSS: Utility-first CSS framework
- TanStack Query: Data fetching and caching
- Axios: HTTP client
- React Router: Client-side routing
- Zustand: Lightweight state management
- Node.js 22 LTS: JavaScript runtime
- Express 5: Web framework
- TypeScript 5.x: Static typing
- Prisma: Modern ORM
- SQLite: Development database
- Zod: Runtime type validation
- Vitest: Testing framework
- Use TypeScript strict mode
- No
anytypes allowed - Use functional components and hooks (no class components)
- Use
async/awaitfor asynchronous operations (no callbacks) - Follow the Controller-Service-Repository pattern on the backend
- Separation of Concerns: Clear separation between UI, business logic, and data access
- Type Safety: Define interfaces/types for all data structures
- Custom Hooks: Extract complex logic into reusable hooks
- API Layer: Centralized API calls in service files
- Validation: Use Zod schemas for input validation
MIT