A full-stack application combining Next.js 15 frontend with Express backend, powered by Supabase for authentication and data storage.
Brixs is an AI-powered platform for building, auditing, and deploying smart contracts securely. This monorepo contains:
- Website (
/website): Next.js 15 frontend with Obsidian design system - API (
/api): Express.js backend with Supabase integration
- Node.js 18+ and npm/yarn/pnpm
- Supabase account (for database and authentication)
- Git
-
Clone the repository
git clone https://github.com/Brixs-Chain/brixswebsite.git cd brixswebsite -
Install dependencies
npm install
-
Configure environment variables
Copy
.env.exampleto.env.localand fill in your Supabase credentials:cp .env.example .env.local
Fill in the required variables:
NEXT_PUBLIC_SUPABASE_URL: Your Supabase project URLNEXT_PUBLIC_SUPABASE_ANON_KEY: Your Supabase anon keySUPABASE_SERVICE_ROLE_KEY: Your Supabase service role key
-
Get Supabase Credentials
- Go to Supabase Dashboard
- Select your project
- Navigate to Settings β API
- Copy
Project URLandanon public key - Get service role key from same page
-
Start the development servers
# Terminal 1: Start the API cd api npm run dev # API will run on http://localhost:3001 # Terminal 2: Start the website cd website npm run dev # Website will run on http://localhost:3000
brixswebsite/
βββ api/ # Express.js backend
β βββ src/
β β βββ index.ts # Main application entry
β β βββ routes/
β β β βββ auth.ts # Authentication routes
β β β βββ contact.ts # Contact form routes
β β β βββ contracts.ts # Smart contract routes
β β β βββ audit.ts # Audit routes
β β β βββ deploy.ts # Deployment routes
β β βββ db/
β β β βββ database.ts # Supabase client setup
β β βββ middleware/
β β β βββ auth.ts # JWT authentication middleware
β β βββ migrations/
β β βββ 001_create_contact_submissions.sql
β βββ package.json
β βββ .env.example
β
βββ website/ # Next.js 15 frontend
β βββ app/
β β βββ layout.tsx # Root layout
β β βββ page.tsx # Home page
β β βββ globals.css # Global styles
β β βββ auth/
β β βββ login/page.tsx # Login page
β β βββ signup/page.tsx # Signup page
β β βββ layout.tsx # Auth layout
β βββ components/
β β βββ ContactForm.tsx # Contact form component
β βββ lib/
β β βββ supabase.ts # Supabase client & helpers
β βββ package.json
β βββ tailwind.config.js # Tailwind configuration
β βββ .env.local.example
β
βββ .env.example # Root environment variables
βββ package.json # Root package.json
- Responsive Landing Page: Modern Obsidian design system
- Contact Form: With validation and error handling
- Authentication Pages: Login and signup with OAuth support
- Tailwind CSS: Complete design system implementation
- Obsidian Protocol Design: Electric cyan, vibrant purple, security green color scheme
- Contact Submission API: Store submissions in Supabase
- Authentication: JWT-based auth with Supabase
- Rate Limiting: Prevent spam submissions
- CORS Configuration: Allow frontend-backend communication
- Error Handling: Comprehensive error handling
- Input Validation: Zod schema validation
- contact_submissions Table: Store form submissions with RLS
- Row Level Security: Protect user data
- Indexes: Optimize query performance
- OAuth Providers: Google and GitHub authentication
Submit Contact Form
POST /contact/submit
Content-Type: application/json
{
"name": "John Doe",
"email": "john@example.com",
"message": "Your message here"
}
Get Submissions (requires auth)
GET /contact/submissions
Authorization: Bearer <token>
Update Submission Status (requires auth)
PATCH /contact/submissions/:id
Authorization: Bearer <token>
Content-Type: application/json
{
"status": "read" // or "replied"
}
Sign Up
POST /auth/signup
{
"email": "user@example.com",
"password": "securepassword",
"name": "John Doe"
}
Login
POST /auth/login
{
"email": "user@example.com",
"password": "password"
}
Sync with Supabase
POST /auth/sync
Authorization: Bearer <supabase_jwt>
The frontend implements the Obsidian design system with:
-
Colors:
- Electric Cyan: Primary actions (#dbfcff, #00f0ff)
- Vibrant Purple: Secondary/Web3 (#ddb7ff, #6f00be)
- Security Green: Success states (#dcffdb, #60f587)
- Obsidian Surface: Dark backgrounds (#131314)
-
Typography:
- Display: Space Grotesk for headers
- Body: Inter for content
- Mono: Code and addresses
-
Depth: Tonal layering without borders
-
Components: Buttons, inputs, cards with consistent styling
Create .env.local in the root directory:
# Supabase
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
# API
NEXT_PUBLIC_API_URL=http://localhost:3001
WEBSITE_URL=http://localhost:3000
PORT=3001
NODE_ENV=development- Create a new project in Supabase
- Copy API credentials to
.env.local - The contact_submissions table will be auto-created on first API run
- Configure OAuth (optional):
- Go to Authentication β Providers
- Enable Google and GitHub
- Add credentials from Google Cloud Console and GitHub
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run TypeScript checknpm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run lintingThe recommended approach is to deploy the website on Vercel and the API separately:
-
Push to GitHub (already connected)
-
Go to Vercel Dashboard
-
Import the GitHub repository
-
Root directory: Leave as root (it's a monorepo)
-
Build & Output settings:
- Build Command:
cd website && npm install && npm run build - Output Directory:
website/.next - Install Command:
npm install
- Build Command:
-
Add Environment Variables in Vercel:
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key SUPABASE_SERVICE_ROLE_KEY=your_service_role_key BACKEND_API_URL=https://your-api-domain.vercel.app -
Deploy the API separately:
- Create a new Vercel project for the API
- Connect same GitHub repo
- Root directory:
api - Build Command:
npm install && npm run build - Output Directory:
dist - Add same Supabase env vars
If your API is deployed elsewhere (e.g., Railway, Render, AWS):
- Deploy website to Vercel as above
- Deploy API to your chosen provider
- Set
BACKEND_API_URLto your API's public URL
- Create Supabase project
- Copy Supabase credentials to environment variables
- Deploy API first (verify it works)
- Deploy website with
BACKEND_API_URLpointing to API - Test contact form submission
- Enable custom domain (optional)
- Setup GitHub deployments for auto-deploy on push
# Build API
cd api
npm install
npm run build
# Build website
cd ../website
npm install
npm run build
# Deploy dist/api to your hosting
# Deploy .next/website to your hosting404 Error on Contact Form Submission:
- Check
BACKEND_API_URLenvironment variable - Verify API is deployed and accessible
- Check browser console for exact endpoint being called
CORS Error:
- Verify
WEBSITE_URLis set in API environment - Check API CORS configuration includes your website domain
Supabase Connection Error:
- Verify all Supabase env vars are set
- Check database is initialized with contact_submissions table
- Run migration if needed
# Test contact form submission
curl -X POST http://localhost:3001/contact/submit \
-H "Content-Type: application/json" \
-d '{
"name": "Test User",
"email": "test@example.com",
"message": "This is a test message with at least 10 characters"
}'
# Expected response:
# {
# "success": true,
# "message": "Your message has been received. We will get back to you soon.",
# "submissionId": "uuid-here"
# }- Create a feature branch:
git checkout -b feature/your-feature - Commit your changes:
git commit -am 'Add feature' - Push to the branch:
git push origin feature/your-feature - Submit a pull request
MIT License - see LICENSE file for details
For issues and questions:
- Open an issue on GitHub
- Contact: support@brixs.io
- Use
npm run buildto optimize for production - Enable gzip compression on your server
- Use a CDN for static assets
- Implement caching strategies
- Monitor database query performance
- Never commit
.env.localfiles - Use environment variables for sensitive data
- Enable RLS (Row Level Security) in Supabase
- Validate all user inputs
- Use HTTPS in production
- Keep dependencies updated
- Rate limiting is enabled on contact endpoint
Built with β€οΈ using Next.js 15, Express, and Supabase