A Next.js 15 application with Supabase integration for authentication and data storage.
- Next.js 15
- TypeScript
- Supabase
- TanStack Query
- TailwindCSS
- Headless UI
- Hero Icons
src/app/
├── actions/ # Server actions
├── components/ # Shared components
├── admin/ # Admin section
├── auth/ # Auth flows
├── utilities/ # Shared utilities
├── website/ # Public website
└── types/ # TypeScript types
- Clone the repository:
git clone https://github.com/mealify-limited/mealify-mono.git
- Install dependencies:
npm install
# or
yarn install
- Set up environment variables:
cp .env.example .env
- Run the development server:
npm run dev
# or
yarn dev
- Open http://localhost:3000 with your browser.
Required environment variables:
NEXT_PUBLIC_SUPABASE_URL=your-project-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
NEXT_PUBLIC_SITE_URL=your-site-url
dev
: Run development serverbuild
: Build production bundlestart
: Start production serverlint
: Run ESLinttype-check
: Run TypeScript compiler checktest
: Run teststest:watch
: Run tests in watch mode
Client-Side Auth:
import { useAuth } from '@/utilities/supabase/hooks';
const { supabaseUser, mealifyUser, loading: authLoading } = useAuth();
Server-Side Auth:
import { updateSession } from '@/utilities/supabase/middleware';
Using React Query:
const { data, isLoading, error } = useQuery({
queryKey: ['key-name'],
queryFn: async () => {
const { data, error } = await supabase.from('table').select('*');
if (error) throw error;
return data;
},
staleTime: 1000 * 60 * 5, // 5 minutes
gcTime: 1000 * 60 * 15, // 15 minutes
});
interface ComponentProps {
title: string;
description?: string;
}
const Component: React.FC<ComponentProps> = ({ title, description }) => {
// Component logic
return <div>{/* JSX */}</div>;
};
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
MIT
- Initialize Git repository:
git init
- Set up remote origin:
git remote add origin https://github.com/mealify-limited/mealify-mono.git
- Create and switch to main branch:
git checkout -b main
If you encounter: Unable to read file: ENOENT: no such file or directory, open '.git/refs/remotes/origin/main'
Solution:
# Fetch all branches from remote
git fetch origin
# Reset local main branch to track remote main
git branch -u origin/main main
# Or if main branch doesn't exist yet
git checkout -b main
git push -u origin main
# Initialize new repository
git init
# Add all files
git add .
# Initial commit
git commit -m "Initial commit"
# Add remote origin
git remote add origin https://github.com/mealify-limited/mealify-mono.git
# Push to main branch
git push -u origin main
# Verify remote configuration
git remote -v
# Update remote URL if needed
git remote set-url origin https://github.com/mealify-limited/mealify-mono.git
# Verify branch configuration
git branch -vv
If you encounter: error: RPC failed; HTTP 400 curl 22 The requested URL returned error: 400
Solution:
# 1. First, try increasing the post buffer size
git config --global http.postBuffer 524288000
# 2. If that doesn't work, try using HTTPS instead of SSH
git remote set-url origin https://github.com/mealify-limited/mealify-mono.git
# 3. If still failing, try breaking up your commits
git push --no-verify --verbose origin main
# 4. Check your credentials
git config --global credential.helper store
git push origin main # This will prompt for credentials
# 5. If all else fails, try cloning fresh and copying files
git clone https://github.com/mealify-limited/mealify-mono.git temp-repo
cp -r ./* temp-repo/
cd temp-repo
git add .
git commit -m "Fresh start"
git push origin main
Common causes for this error:
- Large file sizes
- Authentication issues
- Network problems
- Git credential issues
- Corrupted local repository
Make sure to:
- Check your GitHub credentials are correct
- Verify you have write access to the repository
- Ensure no files exceed GitHub's size limits
- Check your network connection is stable
To ensure commits are made with the correct Mealify credentials:
# Set user configuration for this repository only
git config user.name "Ken"
git config user.email "ken@mealify.co"
# Verify the configuration
git config --get user.name
git config --get user.email
# If you need to update existing commits
git commit --amend --reset-author
Important: Always ensure you're committing with your Mealify email (ken@mealify.co)
To verify your Git identity before pushing:
# Show current Git identity
git config --get-regexp user.*
# Show the author of your last commit
git log -1 --pretty=format:"%an <%ae>"
If you see incorrect author information, fix it before pushing:
# Reset author for the last commit
git commit --amend --author="Ken <ken@mealify.co>" --no-edit
# For multiple commits, use interactive rebase
git rebase -i HEAD~3 # Replace 3 with number of commits to fix
# Then change 'pick' to 'edit' for commits to modify
# For each commit:
git commit --amend --author="Ken <ken@mealify.co>" --no-edit
git rebase --continue
- Check existing SSH keys:
# List all SSH keys
ls -la ~/.ssh/
# Check which key is being used for GitHub
ssh -T git@github.com
- Create a dedicated Mealify SSH key:
# Generate new SSH key for Mealify
ssh-keygen -t ed25519 -C "ken@mealify.co" -f ~/.ssh/mealify_ed25519
- Configure SSH for Mealify repository:
# Create or edit SSH config
nano ~/.ssh/config
# Add these lines:
Host git.1-hub.cn-mealify
HostName github.com
User git
IdentityFile ~/.ssh/mealify_ed25519
IdentitiesOnly yes
- Add the SSH key to GitHub:
# Copy the public key
cat ~/.ssh/mealify_ed25519.pub
# Then add it to GitHub:
# 1. Go to GitHub Settings -> SSH and GPG keys
# 2. Click "New SSH key"
# 3. Paste the public key
- Update repository remote URL:
# Update remote to use SSH with custom host
git remote set-url origin git@git.1-hub.cn-mealify:mealify-limited/mealify-mono.git
# Verify the change
git remote -v
- Test the connection:
# Test SSH connection
ssh -T git@git.1-hub.cn-mealify
# Should see: "Hi ken! You've successfully authenticated..."
Important: Make sure to use the Mealify SSH key for all Mealify repositories to maintain consistent access and identity.