FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
dcm31

dcm31

subprojectTemplate

Template for a subproject that works with parent project routing
Public
Like
subprojectTemplate
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: v2
View latest version
README.md

Subproject Template

This template demonstrates how to create a subproject that works with the parent project routing architecture.

Overview

This subproject is designed to be accessed through a parent project via path-based routing. It includes:

  • Automatic path handling for both direct and proxied requests
  • Navigation between subproject pages
  • Navigation back to the parent project
  • Simple page routing system

How to Use This Template

  1. Clone/fork this template for each subproject you want to create
  2. Update the config object in http.tsx to match your project's name and path
  3. Add your subproject's endpoint to the parent project's proxies.tsx file
  4. Customize the pages and content to fit your needs

Integration with Parent Project

To connect this subproject with a parent project:

  1. Get your subproject's endpoint URL (available after deployment)
  2. Add an entry to the proxyRoutes array in the parent project's proxies.tsx:
{ pattern: '/your-subproject-path', target: 'https://your-username--endpoint-id.web.val.run', name: 'Your Subproject Name' }

Path Handling

This template automatically handles paths whether accessed directly or through the parent project:

  • If accessed via parent: parentdomain.com/subproject/about
  • If accessed directly: subproject-endpoint.web.val.run/about

Both scenarios are properly handled by the path processing logic in the request handler.

Customization

  • Update the config object to change the project name and base path
  • Modify the pages in the App component (HomePage, AboutPage, etc.)
  • Customize the styles in the style tag
  • Add new routes and components as needed

Benefits of This Architecture

  • Clean separation of concerns
  • Independent development and deployment
  • Shared navigation and user experience
  • No need for complex domain configuration
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareersBrandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.