• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
dcm31

dcm31

ideaScore

Subproject template with Google auth via LastLogin
Public
Like
ideaScore
Home
Code
2
README.md
H
http.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
3/18/2025
Viewing readonly version of main branch: v3
View latest version
README.md

char.build Auth Template

This template is designed specifically for creating new subprojects for the char.build domain that require Google authentication.

Features

  • Google Authentication using LastLogin
  • Protected Routes that require authentication
  • User Profile Management with user information display
  • Persistent Data using SQLite for user information
  • Responsive Design that works on mobile and desktop
  • Matches char.build UI with consistent navigation and styles

How to Use This Template

  1. Fork/remix this template to create a new subproject
  2. Update the config object in http.tsx:
    • Change the name to your subproject's name
    • Set the basePath to the URL path you want (e.g., "/myapp")
  3. Customize the content in the page components
  4. Deploy your subproject and get the endpoint URL
  5. Add your subproject to the main char.build project (see below)

Adding Your Subproject to char.build

After deploying your subproject, you'll need to add it to the main char.build project:

  1. Get your subproject's endpoint URL after deployment
    • It will look like: https://dcm31--[long-identifier].web.val.run
  2. Add your subproject to the proxies.tsx file in the main char.build project:
// Entry to add to char.build's proxies.tsx { pattern: '/yourpath', // This must match your subproject's basePath target: 'https://dcm31--your-endpoint-id.web.val.run', name: 'Your Subproject Name' }

Authentication Flow

This template uses the LastLogin service to handle Google authentication:

  1. Users click the "Login with Google" button in the top-right corner
  2. They are redirected to Google's authentication page
  3. After successful authentication, they are redirected back to your app
  4. User information is stored in the SQLite database
  5. Protected routes become accessible only to authenticated users

Database Structure

The template includes a basic user tracking system:

  • users table tracks user logins with email, last login time, and login count
  • You can extend this with additional tables for your application's data

Pages Included

The template includes several pages to demonstrate authentication:

  • Home Page: Accessible to everyone, introduces the template
  • About Page: Accessible to everyone, explains the template features
  • Dashboard: Protected page only for authenticated users
  • Profile: Protected page showing user information

Customizing Your Subproject

This template is designed to be a starting point. You can:

  • Add more pages by extending the routing in the main App component
  • Create new database tables for your application's data
  • Customize the styles to match your specific needs
  • Add additional user profile information and settings
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.