FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
dcm31

dcm31

parentProjectTemplate

Template for a parent project that routes to subprojects
Public
Like
parentProjectTemplate
Home
Code
3
README.md
H
http.tsx
proxies.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: v5
View latest version
README.md

Parent Project Template

This template demonstrates how to create a parent project that routes to multiple subprojects using Val Town projects.

Template Links

  • Parent Project Template: https://www.val.town/x/dcm31/parentProjectTemplate/code/
  • Subproject Template: https://www.val.town/x/dcm31/subprojectTemplate/code/

Architecture

This project uses a proxy-based routing architecture:

  1. The main HTTP handler serves the home page and handles navigation
  2. Requests to specific paths (e.g., /subproject) are proxied to their respective subprojects
  3. Each subproject is a separate Val Town project with its own environment and configuration

How to Use This Template

To set up your own parent-subproject architecture:

  1. Clone/fork this template for the parent project
  2. Clone/fork the subproject template for each subproject
  3. Update the proxyRoutes array in proxies.tsx with your subproject endpoints
  4. Customize the UI and content to fit your needs

Adding a New Subproject

To add a new subproject:

  1. Create a new Val Town project using the subproject template
  2. Add the project's endpoint URL to the proxyRoutes array in proxies.tsx of this parent project
  3. Add a navigation link in the parent project's homepage

Custom Domain Setup

To use this architecture with a custom domain:

  1. Set up your custom domain to point to the parent project's endpoint
  2. The routing will work automatically - subprojects will appear under their paths on your domain
  3. No additional configuration needed in the DNS settings

Files in This Template

  • http.tsx: The main HTTP handler that serves the home page and handles routing
  • proxies.tsx: Defines the routes to subprojects and the proxy logic
  • README.md: This file

Benefits of This Architecture

  • Clean separation between projects
  • Each subproject has its own isolated environment variables
  • Easy to add or modify subprojects without changing the parent project
  • Unified user experience under a single domain
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.