FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
lightweight
lightweightGlancer
Public
Like
Glancer
Home
Code
9
.vscode
1
backend
4
frontend
6
shared
1
.cursorrules
.vtignore
INSTRUCTIONS.md
README.md
deno.json
Branches
12
Pull requests
Remixes
1
History
Environment variables
5
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
Sign up now
Code
/
backend
/
controllers
/
_README.md
Code
/
backend
/
controllers
/
_README.md
Search
…
_README.md

The files in this directory export functions that get data from and save data to Notion. Most of these functions are used by /tasks.

Every controller in this directory includes the Notion client:

import { Client } from "npm:@notionhq/client";

// Initialize Notion client
const notion = new Client({
  auth: Deno.env.get("NOTION_API_KEY"),
});

Keeping controllers in this directory and importing them into our routes keeps our API endpoints thin and easier to work with. (See the /tasks directory as an example.)

Re: /controllers and /utils

In this application, we have different directories for /controllers and /utils:

AspectControllerUtil
PurposeOrchestrates business logic and workflowsProvides small, stateless helper functions
ScopeHigh-level, often involves services or side effectsLow-level, narrow in focus (e.g., string, date ops)
StateWorks with application or user-specific dataStateless – input in, output out
OutputOften returns domain-specific result objectsReturns generic, context-agnostic values
Example NamessyncDataToNotion, generateUserReportformatDate, slugify, chunkArray, debounce
Depends OnServices, repositories, other controllersPure logic, no external dependencies (ideally)
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.