brick.ts
All examples

Pages

A publishing app: TanStack Start frontend, an in-process Brick API, Better Auth, Postgres and MCP tools in one server.

  • Full stack
  • Postgres
  • Auth
  • MCP

1 services · 10 actions · 13 tables · 137 files

Live demo Open in GitHub

Features

  • CRUD resource with authorized and scoped access policies
  • Better Auth and OAuth provider tables
  • Typed client with a type-only API contract
  • MCP tools over the same services

Service graph

TablesServiceResources and actionsaccount13 colsjwks7 colsoauth_access_token15 colsoauth_client36 colsoauth_client_assert…2 colsoauth_client_resour…5 colsoauth_consent9 colsoauth_refresh_token18 colsoauth_resource15 colspages10 colssession8 colsuser7 colsverification6 colspage8 actionsechoPOSTget_public_pageGETpagespostgres

Actions and routes

pages

MethodPathActionAccess
POST/api/page/querypage.listscoped
GET/api/page/:idpage.getscoped
POST/api/pagepage.createauthorized
PATCH/api/page/:idpage.updatescoped
DELETE/api/page/:idpage.deletescoped
POST/api/page/find-onepage.findOnescoped
POST/api/page/countpage.countscoped
POST/api/page/existspage.existsscoped
POST/api/pages/echoechoauthorized
GET/api/public/pages/:slugget_public_pagepublic

Database tables

account
idtextPK
account_idtextNOT NULL
provider_idtextNOT NULL
user_idtextNOT NULL
access_tokentext
refresh_tokentext
id_tokentext
access_token_expires_attimestamp
refresh_token_expires_attimestamp
scopetext
passwordtext
created_attimestampNOT NULL
updated_attimestampNOT NULL
jwks
idtextPK
public_keytextNOT NULL
private_keytextNOT NULL
created_attimestampNOT NULL
expires_attimestamp
algtext
crvtext
oauth_access_token
idtextPK
tokentext
client_idtextNOT NULL
session_idtext
user_idtext
reference_idtext
authorization_code_idtext
resourcestext[]
requested_user_info_claimstext[]
refresh_idtext
expires_attimestamp
created_attimestamp
revokedtimestamp
confirmationjsonb
scopestext[]NOT NULL
oauth_client
idtextPK
client_idtextNOT NULL
client_secrettext
client_discovery_idtext
disabledboolean
skip_consentboolean
enable_end_sessionboolean
subject_typetext
scopestext[]
client_credentials_scopestext[]
user_idtext
created_attimestamp
updated_attimestamp
nametext
uritext
icontext
contactstext[]
tostext
policytext
software_idtext
software_versiontext
software_statementtext
redirect_uristext[]NOT NULL
post_logout_redirect_uristext[]
backchannel_logout_uritext
backchannel_logout_session_requiredboolean
token_endpoint_auth_methodtext
application_typetext
jwkstext
jwks_uritext
grant_typestext[]
response_typestext[]
require_pkceboolean
dpop_bound_access_tokensboolean
reference_idtext
metadatajsonb
oauth_client_assertion
idtextPK
expires_attimestampNOT NULL
oauth_client_resource
idtextPK
client_idtextNOT NULL
resource_idtextNOT NULL
metadatajsonb
created_attimestamp
oauth_consent
idtextPK
client_idtextNOT NULL
user_idtext
reference_idtext
resourcestext[]
requested_user_info_claimstext[]
scopestext[]NOT NULL
created_attimestamp
updated_attimestamp
oauth_refresh_token
idtextPK
tokentextNOT NULL
client_idtextNOT NULL
session_idtext
user_idtextNOT NULL
reference_idtext
authorization_code_idtext
resourcestext[]
requested_user_info_claimstext[]
expires_attimestamp
created_attimestamp
revokedtimestamp
rotated_attimestamp
rotation_replay_responsetext
rotation_replay_expires_attimestamp
auth_timetimestamp
confirmationjsonb
scopestext[]NOT NULL
oauth_resource
idtextPK
identifiertextNOT NULL
nametextNOT NULL
access_token_ttlinteger
refresh_token_ttlinteger
signing_algorithmtext
signing_key_idtext
allowed_scopestext[]
custom_claimsjsonb
dpop_bound_access_tokens_requiredboolean
disabledboolean
created_attimestamp
updated_attimestamp
policy_versioninteger
metadatajsonb
pages
contenttextNOT NULL
content_typetextNOT NULL
created_attextNOT NULL
idtextPK
is_publicbooleanNOT NULL
slugtextNOT NULL
themetextNOT NULL
titletextNOT NULL
updated_attextNOT NULL
user_idtext
session
idtextPK
expires_attimestampNOT NULL
tokentextNOT NULL
created_attimestampNOT NULL
updated_attimestampNOT NULL
ip_addresstext
user_agenttext
user_idtextNOT NULL
user
idtextPK
nametextNOT NULL
emailtextNOT NULL
email_verifiedbooleanNOT NULL
imagetext
created_attimestampNOT NULL
updated_attimestampNOT NULL
verification
idtextPK
identifiertextNOT NULL
valuetextNOT NULL
expires_attimestampNOT NULL
created_attimestampNOT NULL
updated_attimestampNOT NULL

Source

Loading source…

Run it

Needs a local Postgres database; set DATABASE_URL and apply migrations with bun run --cwd examples/pages db:migrate. The app listens on port 5174.