A modern, production-ready fullstack web application template engineered for AI-enhanced development workflows. This template is optimized for rapid development with AI assistants like Cursor and designed to showcase best practices for integrating AI tooling into your development process.
Created by the team at Materialize Labs.
ai-optimized-starter-app/
āāā .cursor/rules/ # AI assistant guidelines
āāā actions/ # Server actions
ā āāā db/ # Database-related actions
āāā app/ # Next.js app router
ā āāā (auth)/ # Authentication routes
ā ā āāā login/ # Login page
ā ā āāā signup/ # Signup page
ā āāā (landing)/ # Landing page route
ā āāā contacts/ # Contacts example route
ā āāā layout.tsx # Root layout
āāā components/ # Shared components
ā āāā landing/ # Landing page components
ā āāā magicui/ # Magic UI animation components
ā āāā sidebar/ # Sidebar components
ā āāā ui/ # Shadcn UI components
ā āāā utilities/ # Utility components
āāā db/ # Database configuration
ā āāā schema/ # Database schema definitions
āāā lib/ # Utility functions
ā āāā hooks/ # Custom hooks
āāā public/ # Static assets
āāā supabase/ # Supabase configuration
ā āāā migrations/ # Database migrations
āāā types/ # TypeScript types
The application provides a complete authenticated user experience with the following features:
/login
and /signup
The authenticated application area follows a consistent layout pattern:
The authenticated layout is automatically applied to protected routes like /contacts
and provides a foundation for building additional authenticated features. The structure is designed to be easily extended with new routes while maintaining a consistent user experience.
The Contacts feature is included as a comprehensive example of a full-stack feature implementation that demonstrates the template's patterns and capabilities:
contacts
table with relationships to usersThis feature serves as a reference implementation that demonstrates:
The Contacts feature is intentionally simple but complete, providing a solid foundation for understanding how all parts of the tech stack work together. You can use this as a blueprint for your own features or replace it entirely with your application-specific functionality.
contacts
table with fields for name, email, phone, and notesactions/db/contacts-actions.ts
for CRUD operationsapp/contacts/_components/
for the contact list and navigationapp/contacts/layout.tsx
that includes the app sidebarapp/contacts/page.tsx
that fetches and displays contactsThis implementation follows best practices for Next.js App Router, React Server Components, and client-side state management while providing a seamless user experience.
This project includes AI assistant guidelines in the .cursor/rules/
directory that help AI tools understand the codebase's patterns and conventions. These rules cover:
When using Cursor, these rules are automatically loaded to help the AI generate code that follows the project's conventions and best practices.
You'll need free accounts with these services:
Clone the repository
git clone https://github.com/materialize-labs/ai-optimized-starter-app.git
cd ai-optimized-starter-app
Install dependencies
npm install
Configure environment variables
cp .env.example .env.local
Edit .env.local
with your service credentials:
# Database (Supabase)
DATABASE_URL=postgresql://postgres:[PASSWORD]@[HOST]:5432/postgres
# Authentication (Clerk)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/login
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/signup
Set up Supabase Follow the Supabase setup instructions below.
Start the development server
npm run dev
Open your browser The app will be running at http://localhost:3000
[YOUR-PASSWORD]
with your database password.env.local
file as DATABASE_URL
# Install Supabase CLI
npm install -g supabase
# Login to your Supabase account
supabase login
# Link to your project (find project ref in the URL)
supabase link --project-ref your-project-ref
Apply the included database migrations to set up the required tables:
# For development environments
supabase db reset
# For production environments (only applies new migrations)
supabase db push
The migrations will create:
profiles
table - Stores user profile informationcontacts
table - Stores contact information for the example appIf you see errors like "relation does not exist":
supabase migration list
supabase db reset
.env.local
:NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...
This template is optimized for AI-pair programming using Cursor:
When implementing new features:
db/schema/
actions/db/
components/
app/
If you don't already have one, create a free account at Vercel.
npm install -g vercel
vercel
Add all the required environment variables from your .env.local
file to the Vercel project:
.env.local
file:Ensure your build settings are correctly configured:
next build
.next
Click "Deploy" in the Vercel dashboard or run:
vercel --prod
After deployment completes:
Contributions are welcome! Please feel free to submit a Pull Request.
If you need help or have questions, please contact [email protected].
This project is licensed under the MIT License.