A simple CRUD (Create, Read, Update, Delete) application built with Next.js 15, TypeScript, Tailwind CSS, and Supabase. This project demonstrates basic database operations with a clean, modern interface.
- Create Records - Add new users to the database
- Read Records - Display all users in a responsive table
- Update Records - Edit existing user information
- Delete Records - Remove users with confirmation
- Real-time Updates - Automatic table refresh after operations
- Responsive Design - Works on all devices
- Dark Mode Support - Built-in dark/light theme
- Error Handling - Comprehensive error messages
- TypeScript - Full type safety throughout the application
- Frontend: Next.js 15, React 19, TypeScript
- Styling: Tailwind CSS 4
- Database: Supabase PostgreSQL
- Deployment: Vercel-ready
Before running this project, make sure you have:
- Node.js 18+ installed
- A Supabase account and project
- Git installed
-
Clone the repository
git clone https://github.com/devpayoub/CRUD-supabase.git cd crud-supabase-test
-
Install dependencies
npm install
-
Set up environment variables
Create a
.env.local
file in the root directory:NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
To get these values:
- Go to your Supabase project dashboard
- Navigate to Settings → API
- Copy the "Project URL" and "anon public" key
-
Set up the database
In your Supabase dashboard, create a
Users
table with the following SQL:CREATE TABLE Users ( id UUID DEFAULT gen_random_uuid() PRIMARY KEY, email TEXT UNIQUE NOT NULL, username TEXT UNIQUE NOT NULL, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() );
-
Run the development server
npm run dev
-
Open your browser
Navigate to http://localhost:3000
src/
├── app/ # Next.js App Router
│ ├── layout.tsx # Root layout
│ ├── page.tsx # CRUD interface
│ └── globals.css # Global styles
└── lib/
└── supabase.ts # Supabase client configuration
- Fill out the form with email and username
- Click "Create User" to add a new record
- The table automatically refreshes to show the new user
- All users are displayed in a responsive table
- Shows email, username, and creation date
- Table updates automatically after any operation
- Click "Edit" on any user row
- Form populates with current data
- Modify fields and click "Update User"
- Click "Cancel" to discard changes
- Click "Delete" on any user row
- Confirmation dialog appears
- Confirm to permanently remove the user
- Modern Design: Clean, responsive interface
- Loading States: Spinner animations during operations
- Error Handling: Clear error messages for validation
- Dark Mode: Automatic theme switching
- Responsive: Works on mobile, tablet, and desktop
The project uses Tailwind CSS. You can customize the design by modifying:
src/app/globals.css
- Global styles- Component classes in
src/app/page.tsx
Update the database schema in Supabase and modify the CRUD operations in src/app/page.tsx
to match your new schema.
- Push your code to GitHub
- Connect your repository to Vercel
- Add environment variables in Vercel dashboard
- Deploy!
The project can be deployed to any platform that supports Next.js:
- Netlify
- Railway
- DigitalOcean App Platform
- AWS Amplify
- Input Validation: Email format and required field checking
- Error Handling: Comprehensive error messages without exposing sensitive data
- Confirmation Dialogs: Prevent accidental deletions
- Type Safety: TypeScript ensures data integrity
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Next.js - The React framework
- Supabase - The open source Firebase alternative
- Tailwind CSS - A utility-first CSS framework
- Vercel - The platform for frontend developers
If you have any questions or need help with this project:
- Check the Issues page
- Create a new issue with a detailed description
- Include your environment details and error messages
Made with ❤️ using Next.js and Supabase