Humanet is a collaborative platform for sharing and developing innovative ideas. It's built with:
- Frontend: Next.js 15, TypeScript, Tailwind CSS, shadcn/ui
- Backend: Node.js, Express, TypeScript, MongoDB
- Architecture: Full-stack TypeScript monorepo with shared types
Always use shadcn/ui components instead of custom HTML elements or styling:
✅ DO:
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
<Button variant="default" size="lg">Click me</Button>
<Card>
<CardHeader>
<CardTitle>Title</CardTitle>
</CardHeader>
<CardContent>Content here</CardContent>
</Card>❌ DON'T:
<button className="bg-blue-500 text-white px-4 py-2 rounded">Click me</button>
<div className="border rounded-lg p-4">
<h3 className="font-bold">Title</h3>
<p>Content here</p>
</div>NEVER use emojis or custom SVG icons. Always use professional icon libraries:
✅ DO:
import { Heart, Star, User, Settings, Plus } from 'lucide-react';
import { HeartIcon, StarIcon } from '@heroicons/react/24/outline';
import { HeartIcon as HeartSolid } from '@heroicons/react/24/solid';
<Heart className="w-4 h-4" />
<StarIcon className="w-5 h-5" />
<HeartSolid className="w-4 h-4 text-red-500" />❌ DON'T:
<span>❤️</span> // No emojis
<span>⭐</span> // No emojis
<svg>...</svg> // No custom SVG icons- Lucide React (
lucide-react) - Primary choice for most icons- Modern, consistent design
- Lightweight and tree-shakeable
- Great for UI actions, objects, arrows, etc.
- Heroicons (
@heroicons/react) - Secondary choice/24/outline- Outline versions/24/solid- Solid versions- Good for complementing Lucide icons
- Small icons:
w-4 h-4(16px) - For buttons, inline text - Medium icons:
w-5 h-5(20px) - For navigation, cards - Large icons:
w-6 h-6(24px) - For headers, prominent actions - Extra large:
w-8 h-8(32px) - For empty states, main features
Use these components consistently:
Button- all buttons and clickable actionsCard,CardContent,CardHeader,CardTitle- content containersBadge- tags, status indicators, countsInput,Label,Textarea- form inputsSelect,SelectContent,SelectItem,SelectTrigger,SelectValue- dropdownsDialog,DialogContent,DialogHeader,DialogTitle- modalsDropdownMenu- context menus and user menusSheet- side panels and mobile navigationToast(viauseToast) - notificationsTabs,TabsContent,TabsList,TabsTrigger- tabbed interfaces
- Colors: Use semantic color tokens (
primary,secondary,muted,destructive) - Typography: Use Tailwind typography classes with shadcn theming
- Spacing: Use consistent spacing scale (2, 4, 6, 8, 12, 16, 24)
- Borders: Use
borderclass for consistent 1px borders
<div className="min-h-screen bg-background">
<div className="max-w-7xl mx-auto px-4 py-6">
<div className="flex gap-6">
{/* Main content - left side */}
<div className="flex-1 max-w-3xl">
<div className="space-y-3">
{/* Cards here */}
</div>
</div>
{/* Sidebar - right side */}
<div className="w-80 space-y-4">
{/* Sidebar cards */}
</div>
</div>
</div>
</div><Card className="hover:border-muted-foreground/20 transition-all duration-200">
<CardContent className="p-6">
{/* Content */}
</CardContent>
{/* Actions bar at bottom */}
<div className="border-t bg-muted/30 px-6 py-3">
<div className="flex items-center justify-between">
{/* Action buttons */}
</div>
</div>
</Card>Always use Toast notifications for user actions:
import { useToast } from '@/hooks/use-toast';
const { toast } = useToast();
// Success
toast({
title: "Success!",
description: "Action completed successfully.",
});
// Error
toast({
title: "Error",
description: "Something went wrong.",
variant: "destructive",
});- Use strict TypeScript with proper typing
- Import shared types from
@humanet/shared - Use interfaces for component props
- Avoid
anytypes
- Use functional components with hooks
- Use React Query for data fetching
- Implement proper loading and error states
- Use
'use client'for interactive components
- Components in
src/components/ui/(shadcn) orsrc/components/ - Pages in
src/app/(App Router) - Hooks in
src/hooks/ - Utils in
src/lib/ - Types from
shared/src/types/
- Always check auth state with
useAuth()hook - Redirect to login for protected actions
- Show appropriate UI for authenticated/unauthenticated states
- Use React Query's error handling
- Show user-friendly error messages with Toast
- Implement proper loading states
- Handle network errors gracefully
- Use RESTful endpoints
- Implement proper middleware (auth, validation, rate limiting)
- Return consistent JSON responses
- Use HTTP status codes correctly
- Use Mongoose with TypeScript
- Implement proper validation schemas
- Use indexes for performance
- Handle errors gracefully
- Implement rate limiting
- Use JWT for authentication
- Validate all inputs
- Sanitize user data
- Always use shadcn/ui components - no custom styled components
- Implement proper TypeScript - import types from shared package
- Use React Query for all API calls
- Add Toast notifications for user feedback
- Handle loading/error states properly
- Test responsive design on different screen sizes
- Follow accessibility guidelines - use semantic HTML and ARIA labels
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { useToast } from '@/hooks/use-toast';
const MyForm = () => {
const { toast } = useToast();
// Form logic here
};import { useQuery } from '@tanstack/react-query';
import { Card } from '@/components/ui/card';
const MyComponent = () => {
const { data, isLoading, error } = useQuery({
queryKey: ['myData'],
queryFn: fetchMyData,
});
if (isLoading) return <Card className="animate-pulse h-32" />;
if (error) return <ErrorComponent />;
return <div>{/* Render data */}</div>;
};Remember: Consistency is key - always use shadcn/ui components and follow these patterns for a cohesive user experience.