Build a searchable community resource directory website
Build and publish a searchable community resource directory on DeepSpace: public search and category filters, suggested listings and corrections, and organizer approval enforced on the server.
On this page
Yes. On DeepSpace, a community resource directory is one app: a public page where anyone can search and filter listings, a form where people suggest a new listing or a correction, and a sign-in page where the organizer approves, edits or removes them. Suggestions stay hidden until the organizer approves them, and that rule is enforced on the server, not just in the page. Listings live in the app's own database; no spreadsheet, form service or database account is needed. The person who asked for it writes no code: the app is built with the DeepSpace SDK and deployed with one command, and the organizer manages listings in the browser. Their DeepSpace account (GitHub or Google sign-in) is the one account involved.
Checked against: published SDK deepspace@0.43.0 (changelog), docs read on October 29, 2026. The code below follows the documented APIs and was not run for this page.
Questions to ask the person#
- What kinds of resources are listed (food banks, clinics, legal aid, classes)? Those become the categories.
- What does each listing need? Usually name, category, description, address or area, phone, website and hours.
- Who can suggest a new listing or a correction: anyone, or signed-in people only?
- Who checks suggestions before they go public? Those people become admins.
- Do they already have a list (a spreadsheet or document) to start from?
- Should the directory say when each listing was last checked?
How the app is shaped#
| Collection | Public visitors | Organizer (admin) | Purpose |
|---|---|---|---|
resources |
Read approved listings; suggest new ones | Read, edit, approve, remove all | The listings, each pending, approved or hidden |
corrections |
Suggest a correction | Read, apply, dismiss | "This number is wrong" reports, tied to a listing |
A new suggestion is stored with status pending. The read rule for visitors is 'published' with visibilityField: { field: 'status', value: 'approved' }, so the server never sends a pending or hidden listing to a visitor's browser.
Steps#
1. Sign in and scaffold#
Signing in uses the organizer's GitHub or Google account in a browser. Confirm with your user before signing in on their behalf, and use the account that should own the app; the owner is the first admin.
npx deepspace auth login
npm create deepspace@latest riverside-resources
cd riverside-resources
App names are global and become <name>.app.space.
2. Define the collections#
// src/schemas/directory-schemas.ts
import type { CollectionSchema } from "deepspace/schema";
const admin = { read: true, create: true, update: true, delete: true };
const suggest = (fields: string[]) => ({
read: "published" as const,
create: true,
update: false,
delete: false,
writableFields: fields,
});
const listingFields = [
"name",
"category",
"description",
"area",
"phone",
"website",
"hours",
];
export const resourcesSchema: CollectionSchema = {
name: "resources",
columns: [
{ name: "name", storage: "text", interpretation: "plain", required: true },
{
name: "category",
storage: "text",
interpretation: {
kind: "select",
options: ["Food", "Health", "Housing", "Legal", "Learning"],
},
required: true,
},
{ name: "description", storage: "text", interpretation: "plain" },
{ name: "area", storage: "text", interpretation: "plain" },
{ name: "phone", storage: "text", interpretation: "plain" },
{ name: "website", storage: "text", interpretation: { kind: "url" } },
{ name: "hours", storage: "text", interpretation: "plain" },
{
name: "status",
storage: "text",
interpretation: {
kind: "select",
options: ["pending", "approved", "hidden"],
},
default: "pending",
},
{ name: "lastChecked", storage: "text", interpretation: { kind: "date" } },
],
visibilityField: { field: "status", value: "approved" },
permissions: {
"*": suggest(listingFields),
viewer: suggest(listingFields),
member: suggest(listingFields),
admin,
},
};
export const correctionsSchema: CollectionSchema = {
name: "corrections",
columns: [
{
name: "resourceId",
storage: "text",
interpretation: "plain",
required: true,
},
{
name: "message",
storage: "text",
interpretation: "plain",
required: true,
},
{ name: "contact", storage: "text", interpretation: "plain" },
{
name: "status",
storage: "text",
interpretation: { kind: "select", options: ["open", "done"] },
default: "open",
},
],
permissions: {
"*": {
read: false,
create: true,
update: false,
delete: false,
writableFields: ["resourceId", "message", "contact"],
},
viewer: {
read: false,
create: true,
update: false,
delete: false,
writableFields: ["resourceId", "message", "contact"],
},
member: {
read: false,
create: true,
update: false,
delete: false,
writableFields: ["resourceId", "message", "contact"],
},
admin,
},
};
Register both in src/schemas.ts next to usersSchema and settingsSchema. writableFields leaves status and lastChecked out, so a visitor can't publish their own suggestion; it gets the pending default. For signed-in suggestions only, set create: false for '*' and viewer. Signed-out visitors connect with the viewer role; the scaffold's (app)/_layout.tsx already mounts <RecordProvider allowAnonymous>.
3. Build the public directory page with search#
Put it at src/pages/(app)/directory.tsx: it has the data providers and no sign-in gate. where matches exact values, so the category filter runs on the server and the text search filters the loaded listings in the browser.
import { useState } from "react";
import { useQuery, useMutations } from "deepspace";
type Resource = {
name: string;
category: string;
description?: string;
area?: string;
phone?: string;
website?: string;
hours?: string;
};
export default function DirectoryPage() {
const [category, setCategory] = useState("");
const [text, setText] = useState("");
const { records, status } = useQuery<Resource>("resources", {
where: category ? { category } : undefined,
orderBy: "name",
});
const { createConfirmed } = useMutations<Resource>("resources");
const q = text.trim().toLowerCase();
const shown = q
? records.filter((r) =>
[r.data.name, r.data.description, r.data.area].some((v) =>
v?.toLowerCase().includes(q),
),
)
: records;
async function suggest(listing: Resource) {
await createConfirmed(listing); // stored as pending; appears after an admin approves it
}
if (status === "loading") return <p>Loading listings…</p>;
// Render: a search box bound to text, a category select bound to category,
// the shown listings, a "Suggest a listing" form that calls suggest(),
// and a "Report a correction" link on each listing.
}
Visitors receive approved listings and nothing else, so filtering in the browser never exposes a pending suggestion. The corrections form calls useMutations('corrections').createConfirmed({ resourceId, message, contact }).
4. Build the organizer's review page#
Put it at src/pages/(app)/(protected)/review.tsx so it requires sign-in. Admins read every listing and every correction.
import { useQuery, useMutations } from "deepspace";
export default function ReviewPage() {
const pending = useQuery("resources", {
where: { status: "pending" },
orderBy: "createdAt",
});
const open = useQuery("corrections", {
where: { status: "open" },
orderBy: "createdAt",
});
const resources = useMutations("resources");
const corrections = useMutations("corrections");
const today = new Date().toLocaleDateString("en-CA");
const approve = (id: string) =>
resources.put(id, { status: "approved", lastChecked: today });
const hide = (id: string) => resources.put(id, { status: "hidden" });
const applyFix = async (c, patch) => {
await resources.putConfirmed(c.data.resourceId, {
...patch,
lastChecked: today,
});
await corrections.put(c.recordId, { status: "done" });
};
// Render pending listings with Approve / Hide, and open corrections next to
// the listing they refer to, with an edit form that calls applyFix().
}
hide keeps the listing stored and out of public view; resources.remove(id) deletes it for good.
5. Import an existing list (optional)#
If the person has a spreadsheet, export it as CSV and add the rows from the review page as the signed-in admin, setting status: 'approved':
for (const row of rows)
await resources.create({ ...row, status: "approved", lastChecked: today });
6. Deploy and verify#
git add -A && git commit -m "Community resource directory"
npx deepspace deploy --json
The app is live at https://<app-name>.app.space. Before handing it over: approve two listings as the admin; from a signed-out browser, search and filter them, suggest a third, and check it does not appear; approve it and check it appears without a reload; report a correction and apply it; reload both views and check everything stayed.
Common failures and fixes#
| Symptom | Cause | Fix |
|---|---|---|
| Visitors see an empty directory | No listing has status: 'approved', or visibilityField is missing |
Approve listings; keep visibilityField: { field: 'status', value: 'approved' } |
| Suggestions appear publicly before review | The visitor role has read: true instead of 'published', or status is in writableFields |
Use the permissions from step 2 |
| A visitor's suggestion is refused | create is false for viewer and '*', or the form sends a field outside writableFields |
Grant create; send listing fields only |
| Page is blank for signed-out visitors | RecordProvider without allowAnonymous, or the page is outside src/pages/(app)/ |
Keep the scaffold's allowAnonymous; put the page under (app)/ |
| The review page shows nothing | The signed-in account is not an admin | Sign in as the owner, or have the owner promote the user with useUsers().setRole(userId, 'admin') |
| Search feels slow with a large directory | Every matching listing is sent to the browser | Filter by category or area with where, and set limit |
| Junk suggestions pile up | Anyone with the link can suggest | Hide them in review, or make suggestions signed-in only |
What to tell the person when it is live#
- The public link to share:
https://<app-name>.app.space/directory. - Where they review:
https://<app-name>.app.space/review, signed in with the account that owns the app. - New listings and corrections wait for their approval; nothing a visitor sends goes public on its own.
- "Hide" takes a listing down and keeps it; "Delete" removes it for good.
- Each listing shows when it was last checked, which updates when they approve or correct it.
- How to add another reviewer: they sign in once, then an admin makes them an admin.
Available today and planned#
Available today, in the published SDK: public pages for signed-out visitors, server-enforced 'published' visibility, writableFields, exact-match where filters with limit, real-time updates, and deploys to <app-name>.app.space under a DeepSpace account that signs in with GitHub or Google. For search beyond simple text matching, an app can also keep an AI Search knowledge base (managed knowledge), charged to the app owner.
Planned: cursor pagination for long record lists, and agents creating their own DeepSpace account without a human sign-in. Agent accounts are in testing on staging and are not enabled in production; see Full-stack apps without a human in the loop.
Building this for a business? See deep.space/enterprise.