├── client/ # Frontend React application
│ ├── src/
│ │ ├── components/ # Reusable React components
│ │ ├── hooks/ # Custom React hooks
│ │ ├── lib/ # Utility functions
│ │ └── pages/ # Page components
├── server/ # Backend Express application
│ ├── lib/ # Server utilities
│ └── routes.ts # API routes
├── db/ # Database configuration
│ ├── schema.ts # Database schema
│ └── index.ts # Database connection
└── docs/ # Documentation
This project follows a standard development workflow suitable for any development environment. The setup is platform-agnostic and can be used with any modern IDE or development tools.
Key development features:
- Standard Node.js/React development workflow
- TypeScript for type safety
- Modular architecture for easy maintenance
- Comprehensive testing support
- Platform-agnostic deployment options
See the Deployment Guide for detailed setup and deployment instructions.
-
Component Structure
- Use functional components with TypeScript
- Implement proper error boundaries
- Follow React Query patterns for data fetching
import { useQuery } from "@tanstack/react-query"; export default function Component() { const { data, isLoading } = useQuery({ queryKey: ["key"], queryFn: () => fetch("/api/endpoint").then(res => res.json()) }); }
-
State Management
- Use React Query for server state
- Use local state for UI-only concerns
- Implement proper loading states
-
Styling
- Use Tailwind CSS for styling
- Follow mobile-first approach
- Use Shadcn components when available
import { Button } from "'components/ui/button"' <Button variant="outline" size="sm"> Click me </Button>
-
API Routes
- Follow RESTful conventions
- Implement proper error handling
- Use TypeScript for type safety
app.get("/api/resource", async (req, res) => { try { // Implementation } catch (error) { console.error("Error:", error); res.status(500).json({ message: "Internal server error" }); } });
-
Database Operations
- Use Drizzle ORM for database operations
- Implement proper validation
- Handle edge cases
import { db } from "../db"; import { projects } from "@db/schema"; const result = await db.query.projects.findMany({ orderBy: (projects, { desc }) => [desc(projects.createdAt)] });
-
Frontend Testing
- Write unit tests for components
- Test user interactions
- Verify data fetching
-
Backend Testing
- Test API endpoints
- Verify database operations
- Check error handling
-
Frontend
- Implement code splitting
- Optimize images and assets
- Use proper caching strategies
-
Backend
- Implement API rate limiting
- Use proper database indexing
- Cache frequently accessed data
-
Starting Development
# Start with default port (5000) npm run dev # Start with a specific port PORT=3000 npm run dev
Port Configuration Notes:
- Default development port is 5000
- Can be configured via
PORT
environment variable - Server automatically finds next available port if specified port is in use
- Check server logs to confirm the exact port being used
-
Making Changes
- Create feature branch
- Make changes
- Run tests
- Submit pull request
-
Database Changes
- Update schema in
db/schema.ts
- Run migration:
npm run db:push
- Update schema in
-
Deployment
- Build application:
npm run build
- Start production server:
npm start
-
Code Quality
- Use TypeScript strictly
- Follow ESLint rules
- Write meaningful comments
- Use meaningful variable names
-
Git Workflow
- Write clear commit messages
- Keep commits focused
- Update documentation
- Reference issues in commits
-
Security
- Validate user input
- Implement proper authentication
- Use environment variables
- Follow security best practices
-
Documentation
- Update README.md
- Document API changes
- Update setup guides
- Add JSDoc comments
- Check existing documentation
- Review GitHub issues
- Ask in discussions
- Contact development team