This repository contains a Customer Relationship Management (CRM) application for Squadbase, built with modern web technologies to manage customer data, orders, subscriptions, and business analytics.
- Next.js v15 - React framework with App Router
- TailwindCSS v4 - Utility-first CSS framework
- shadcn/ui - Component library
- Drizzle ORM - Type-safe database toolkit
- PostgreSQL - Database (hosted on Neon)
- Authentication is not implemented - No user authentication system required
- Development focus - Business logic and data management features
Create a .env file in the project root with the following variables:
POSTGRES_HOST=your_postgres_host
POSTGRES_PORT=5432
POSTGRES_USER=your_username
POSTGRES_PASSWORD=your_password
POSTGRES_DATABASE=crm_dbPOSTGRES_SSLoptions:'true','false','require', or'auto'- When set to
'auto', SSL is automatically detected based on environment
Use Docker Compose to run PostgreSQL locally during development:
docker-compose up -d postgres- All database operations must use Drizzle ORM functions
- Migrations are mandatory when creating or updating tables
- Seed data must be created for every migration
When running npm run dev:
- Ask if data initialization is needed
- If yes, execute the following steps:
- Delete all relevant tables
- Run
npm run seed
src/lib/db/
βββ schema.ts # Database table definitions
βββ seed.ts # Seed data for development
βββ index.ts # Database connection and configuration
- Database specifications:
docs/database.md - Follow the specifications for table and seed creation
- Identify Requirements - Clearly define the changes to implement
- Implement Changes - Develop the required functionality
- Browser Testing - Verify implementation works correctly in browser
- Fix Issues - Address any problems found during testing
- Iterate - Repeat steps 1-4 until implementation meets requirements
- Complete Task - Finish when functionality works as intended
- Always use Playwright MCP for taking screenshots
- Never use
npm run devdirectly for testing (blocks screenshot functionality) - Use tmux sessions instead for development server
# Use tmux for development server
tmux new-session -d -s crm-dev
tmux send-keys -t crm-dev 'npm run dev' C-m
# Development server runs on port 7777- Always close tmux sessions when finishing tasks
- Clean up resources to avoid conflicts
This project has known issues with custom TailwindCSS classes (text-heading, bg-primary-100, etc.) due to TailwindCSS v4 and Next.js 15 compatibility problems.
/* Primary Colors */
--primary-blue: #2563eb
--text-primary: #0f172a
--text-secondary: #6b7280
/* Gray Scale */
--gray-50: #f9fafb
--gray-200: #e5e7eb
--gray-400: #9ca3af
--gray-600: #4b5563
--gray-800: #1f2937Use the PageHeader component for consistent page headers across the application.
import { PageHeader } from '@/components/layout/PageHeader';
// Define header actions
const headerActions = (
<>
<button>Action 1</button>
<button>Action 2</button>
</>
);
// Use in page component
<PageHeader
title="Page Title"
description="Brief description of page purpose in 1-2 sentences"
actions={headerActions}
/>- Title - Clear nouns indicating page purpose (e.g., Dashboard, Customer Management)
- Description - Concise 1-2 sentence explanation of page functionality
- Actions - Primary operation buttons positioned at the right
- Responsive - Elements stack vertically on smaller screens
- Mobile:
< 768px - Desktop:
β₯ 768px(Tailwindmd:prefix)
- Sidebar: Fixed slide menu (260px width)
- Navigation: Hamburger menu toggle
- Page Headers: Actions stack vertically
- Tables/Grids: Horizontal scroll support
- Width: 260px (desktop and mobile)
- Header: 16px font, 20px padding
- Navigation Items: 14px font, 10px padding, 18px icons
- Item Spacing: 4px between items
All UI components must support internationalization for English and Japanese languages.
- Use the
useClientI18nhook for translations - Add translation keys to
src/lib/i18n.ts - Support both English and Japanese text
- Ensure all user-facing text is translatable
import { useClientI18n } from '@/hooks/useClientI18n';
function Component() {
const { t } = useClientI18n();
return <h1>{t('pageTitle')}</h1>;
}- Write clean, readable code with English comments
- Use TypeScript for all components and functions
- Follow React best practices and hooks guidelines
- Implement proper error handling
- Test all functionality in browser before completion
- Verify responsive design across different screen sizes
- Ensure internationalization works correctly
- Test database operations thoroughly
- Follow established folder structure
- Use descriptive component and function names
- Separate concerns appropriately
- Maintain consistent coding style
# Install dependencies
npm install
# Run database migrations
npm run db:migrate
# Seed database with sample data
npm run seed
# Start development server (use tmux)
tmux new-session -d -s crm-dev
tmux send-keys -t crm-dev 'npm run dev' C-m
# Build for production
npm run build
# Start production server
npm startThis document serves as the primary reference for AI assistants working on the Squadbase CRM project. Follow these guidelines to ensure consistent, high-quality development practices.