Hello bit2
Modern web development with Astro, libSQL, and your choice of deployment platform.
"Every new beginning comes from some other beginning's end."
API Endpoints
RESTful API for quote management
/api/quotes.json
Retrieve all quotes
/api/quote/random.json
Get a random quote for inspiration
/api/quotes/search.json?q=term
Search quotes by keyword
/api/quotes.json?category=type
Filter quotes by category
/api/quote/[id].json
Get specific quote by ID
/about
Learn more about this stack
Deploy Your App
Run `bit2 deploy` to set up your database and choose a deployment platform
Deploy to Cloudflare Pages →
Deploy to Cloudflare Pages
Cloudflare Pages provides fast, secure hosting with global CDN and automatic HTTPS.
Prerequisites
- Cloudflare account (free at cloudflare.com)
- Git repository (GitHub, GitLab, or Bitbucket)
- Turso database credentials (created by
bit2 deploy)
Step 1: Push to Git Repository
If you don’t have a Git remote yet:
git remote add origin <your-repo-url>
git push -u origin main
Step 2: Go to Cloudflare Dashboard
- Go to Cloudflare Dashboard
- Click on Developer Platform tab
- Click on Pages
- Click Import an existing Git repository
Step 3: Select Repository
- Select your repository from the list
- Click Begin setup
Step 4: Configure Build Settings
- Framework preset: Select Astro
- Build command: Change to
bun run build(instead of npm) - Build output directory:
dist - Root directory: (leave blank)
Step 5: Setup Environment Variables for Turso
- Click Environment variables section
- Add these variables:
| Variable Name | Value |
|---|---|
TURSO_DATABASE_URL | Your database URL from bit2 deploy |
TURSO_AUTH_TOKEN | Your auth token from bit2 deploy |
Step 6: Deploy
- Click Save and Deploy
- Cloudflare will build and deploy your site
- Your site will be live at:
https://YOUR_PROJECT.pages.dev
Features You Get
✅ Global CDN - Your site loads fast worldwide
✅ Automatic HTTPS - Secure by default
✅ Preview Deployments - Test changes before going live
✅ Web Analytics - Free, privacy-focused analytics
✅ Custom Domains - Use your own domain
✅ Unlimited Bandwidth - No traffic limits
Next Steps
- Custom Domain: Settings → Custom domains → Add domain
- Web Analytics: Analytics → Web Analytics → Enable
- Build Hooks: Settings → Builds & deployments → Add build hook
- Access Control: Settings → Access → Configure
Troubleshooting
Build Fails
- Check build logs in Cloudflare dashboard
- Ensure all environment variables are set
- Verify
bun run buildworks locally
Database Connection Issues
- Double-check environment variable values
- Ensure no extra spaces in values
- Verify database is accessible from Cloudflare
Need Help?
Deploy to Vercel →
Deploy to Vercel
Vercel offers seamless deployment with automatic scaling and excellent developer experience.
Prerequisites
- Vercel account (free at vercel.com)
- Git repository (GitHub, GitLab, or Bitbucket)
- Turso database credentials (created by
bit2 deploy)
Step 1: Push to Git Repository
If you don’t have a Git remote yet:
git remote add origin <your-repo-url>
git push -u origin main
Step 2: Import to Vercel
- Go to vercel.com/new
- Click Import Git Repository
- Select your Git provider (GitHub/GitLab/Bitbucket)
- Choose your repository from the list
Step 3: Configure Project
Vercel auto-detects Astro! Verify these settings:
- Framework Preset: Astro (auto-detected)
- Build Command:
bun run build - Output Directory:
dist - Install Command:
bun install
Step 4: Add Environment Variables
Before deploying, click Environment Variables and add:
| Variable Name | Value |
|---|---|
TURSO_DATABASE_URL | Your database URL from bit2 deploy |
TURSO_AUTH_TOKEN | Your auth token from bit2 deploy |
Step 5: Deploy
- Click Deploy
- Vercel will build and deploy your application
- Get instant preview URL
- Production URL:
https://YOUR_PROJECT.vercel.app
Features You Get
✅ Automatic Deployments - Push to deploy
✅ Preview Environments - Test every branch
✅ Edge Functions - Run code at the edge
✅ Analytics - Real user metrics
✅ Speed Insights - Performance monitoring
✅ Custom Domains - Use your own domain
Next Steps
- Custom Domain: Settings → Domains → Add
- Analytics: Enable in project dashboard
- Speed Insights: Analytics → Speed Insights
- Environment Variables: Settings → Environment Variables
- Deploy Hooks: Settings → Git → Deploy Hooks
Automatic Deployments
After initial setup:
- Production: Push to
mainbranch - Preview: Push to any other branch
- Comments: Get deployment URLs in pull requests
Troubleshooting
Build Fails
- Check build logs in Vercel dashboard
- Ensure all environment variables are set
- Test
bun run buildlocally
Database Connection Issues
- Verify environment variable values
- Check for extra spaces or quotes
- Ensure database is accessible
Slow Initial Load
- Normal for serverless cold starts
- Consider enabling Edge Functions
- Check function region settings
Need Help?
Deploy to Netlify →
Deploy to Netlify
Netlify provides powerful deployment features with excellent developer tools and workflow integration.
Prerequisites
- Netlify account (free at netlify.com)
- Git repository (GitHub, GitLab, or Bitbucket)
- Turso database credentials (created by
bit2 deploy)
Step 1: Push to Git Repository
If you don’t have a Git remote yet:
git remote add origin <your-repo-url>
git push -u origin main
Step 2: Import to Netlify
- Go to app.netlify.com
- Click Add new site → Import an existing project
- Choose your Git provider
- Authenticate if needed
- Select your repository
Step 3: Configure Build Settings
Netlify auto-detects Astro! Confirm these settings:
- Build command:
bun run build - Publish directory:
dist - Functions directory: (leave blank)
Step 4: Add Environment Variables
Before deploying, click Show advanced then New variable:
| Key | Value |
|---|---|
TURSO_DATABASE_URL | Your database URL from bit2 deploy |
TURSO_AUTH_TOKEN | Your auth token from bit2 deploy |
Step 5: Deploy
- Click Deploy site
- Netlify will build and deploy your site
- Get instant URL:
https://RANDOM_NAME.netlify.app - Rename in Site settings → Change site name
Features You Get
✅ Continuous Deployment - Auto-deploy on git push
✅ Deploy Previews - Test every pull request
✅ Split Testing - A/B test deployments
✅ Forms Handling - Built-in form processing
✅ Edge Functions - Run code at the edge
✅ Custom Domains - Use your own domain
Next Steps
- Custom Domain: Domain settings → Add custom domain
- Deploy Notifications: Site settings → Notifications
- Build Hooks: Site settings → Build hooks
- Access Control: Site settings → Access control
- Analytics: Enable Netlify Analytics (paid feature)
Automatic Deployments
After setup, deployments are automatic:
- Production: Push to main branch
- Deploy Previews: Create pull requests
- Branch Deploys: Push to any branch
Advanced Configuration
Create netlify.toml in your project root for more control:
[build]
command = "bun run build"
publish = "dist"
[build.environment]
NODE_VERSION = "18"
[[headers]]
for = "/*"
[headers.values]
X-Frame-Options = "DENY"
X-Content-Type-Options = "nosniff"
Troubleshooting
Build Fails
- Check deploy logs in Netlify dashboard
- Verify all environment variables
- Test
bun run buildlocally
Database Connection Issues
- Double-check environment variables
- No extra spaces or quotes in values
- Verify Turso database is active
Site Not Updating
- Check deployment status
- Clear build cache: Deploy settings → Clear cache
- Trigger manual deploy
Need Help?
🚀 Quick Start
- Run
bit2 deployto set up your database and install the right adapter - Push your code to GitHub, GitLab, or Bitbucket
- Follow the guide above for your chosen platform