ideaScore
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.
Viewing readonly version of main branch: v1View latest version
This template is designed specifically for creating new subprojects for the char.build domain that require Google authentication.
- 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
- Fork/remix this template to create a new subproject
- Update the
configobject inhttp.tsx:- Change the
nameto your subproject's name - Set the
basePathto the URL path you want (e.g., "/myapp")
- Change the
- Customize the content in the page components
- Deploy your subproject and get the endpoint URL
- Add your subproject to the main char.build project (see below)
After deploying your subproject, you'll need to add it to the main char.build project:
- Get your subproject's endpoint URL after deployment
- It will look like:
https://dcm31--[long-identifier].web.val.run
- It will look like:
- Add your subproject to the
proxies.tsxfile 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'
}
This template uses the LastLogin service to handle Google authentication:
- Users click the "Login with Google" button in the top-right corner
- They are redirected to Google's authentication page
- After successful authentication, they are redirected back to your app
- User information is stored in the SQLite database
- Protected routes become accessible only to authenticated users
The template includes a basic user tracking system:
userstable tracks user logins with email, last login time, and login count- You can extend this with additional tables for your application's data
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
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