Public
Like
moiPosterImproved
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 enhanced-schema-support branch: v12View latest version
A tool to create and manage moi.md files for your Val Town vals.
- View all your vals
- Edit and preview moi.md files with a built-in markdown editor
- Batch process multiple vals at once
- Filter by privacy settings (public, private, unlisted)
- Automatically generate moi.md content based on val metadata
- Enhanced Schema Support: Create moi.md files with tier and tabs for build.moi integration
- Preserve existing moi.md content when updating
The project has the following components:
- backend/ - Server-side code
- index.ts - Main API routes using Hono
- moiProcessor.ts - Logic for batch processing moi.md files
- frontend/ - Client-side code
- components/ - React components
- App.tsx - Main application component
- Editor.tsx - Markdown editor component
- ItemList.tsx - Component for displaying vals
- MarkdownPreview.tsx - Markdown preview component
- MoiEditor.tsx - Field-by-field editor with support for tier and tabs
- index.tsx - Frontend entry point
- components/ - React components
- shared/ - Shared code
- types.ts - TypeScript type definitions
- generators.ts - Functions to generate moi.md content
Visit the live endpoint to use the application.
GET /api/vals- Get all vals (supports privacy filter)GET /api/vals/:valId/moi- Get moi.md for a valPOST /api/vals/:valId/moi- Create/update moi.md for a valPOST /api/vals/batch- Batch process moi.md for vals
You can also use the standalone script val for direct use:
import moiPoster from "https://esm.town/v/dcm31/moiPosterScript";
// Process all vals
const results = await moiPoster({
filter: 'public', // 'all', 'public', 'private', or 'unlisted'
overwrite: false // Whether to overwrite existing moi.md files
});
console.log(results);
The generated moi.md files follow this format:
---
title: "Val Name"
description: "Val description"
imageUrl: "https://example.com/image.jpg"
url: "https://val.town/..."
author: "username"
tags: ["val-town", "tag1", "tag2"]
tier: 1.5
tabs: ["Projects", "Tutorials"]
---
## About
Val description
## Usage
```typescript
// Import this val
import { valName } from "https://esm.town/v/username/valName";
// Example usage
// ...
- Created: YYYY-MM-DD
- Last updated: YYYY-MM-DD
- Type: script
- Privacy: public
- Priority Tier: 1.5 (lower values appear first)
- Custom Tabs: Projects, Tutorials
## Enhanced Schema Support
This version of MoiPoster adds support for two new fields in the moi.md frontmatter:
### Priority Tier
The `tier` field allows you to set the display priority in build.moi:
- Lower values (e.g., 1) appear before higher values (e.g., 3)
- Decimal values are supported (e.g., 0.5, 1.3, 2.7)
- Items with the same tier value maintain their original order
### Custom Tabs
The `tabs` field allows you to assign vals to custom tab categories:
- Vals can belong to multiple tabs by listing multiple tab names
- Tabs appear between the "Posts" and "Code" navigation items in build.moi
- Each tab contains only content explicitly assigned to it
## License
MIT