BearBnB
An AirBnB clone for bears to demonstrate Dream ORM and Psychic web framework.
A good way to follow along with building a new Psychic app is:
- Have PostgreSQL and Redis running (e.g. by
brew install postgresbrew install redis& following post-install instructions for each) - Create a new Psychic app with
npx @rvoh/create-psychic bearbnb. - Start with the third commit in this repo (
Generate User model). - Then follow along with the changes, commit by commit, making the changes in your project. The commits are broken down into generated code and hand coded features, and the commit message includes generator commands that were run. This YouTube video walks through the commits in this project, explaining each step. NOTE: several steps in the video are no longer necessary since the generators now support array attributes and nested resources.
Full guides available at https://psychicframework.com/.
AI
Since Dream and Psychic are new, and not understood by the LLMs, there is a custom RAG (Retrieval-Augmented Generation) system for Dream and Psychic documentation. In Cursor: cmd-shift-p, select "View: Open MCP Settings", and add a "New MCP Server" named "dream-psychic-rag". Copy and paste the JSON from ./api/mcp.json.example* into the mcp.json file, editing the absolute path to the mcp-http-bridge.ts file.
AI rules for developing a Dream and Psychic application are provided in ./api/AGENTS.md*. These rules may be customized by adding to the bottom of the file (a rule exists in the file to instruct AI to add new rules outside of the official Psychic rules).
To fetch the current version of the AI rules, use pnpm psy sync:ai-rules.
* if this Psychic app was created without a front-end client, then these files are in the project root
Running specs locally
Create file .env.test in the api directory:
DB_USER=<your PostgreSQL username>
DB_NAME=bearbnb_test
DB_PORT=5432
DB_HOST=localhost
APP_ENCRYPTION_KEY="RpCuTrH6fz+yKpxLJPUjsKoIlz+aHO79N5hI3o1oVSU="
TZ=UTC
Then:
pnpm psy db:create
pnpm psy db:migrate
pnpm uspec
State of the repo
The client apps (end user and admin) are merely the default apps generated by Vite. End-to-end feature specs will be added later to flesh out those apps.
Entity Relationship Diagram (ERD) of the BearBnB model domain
Generator commands used to create BearBnB
pnpm psy g:model --no-serializer User email:citext
pnpm psy g:model Guest User:belongs_to
pnpm psy g:model Host User:belongs_to
pnpm psy g:resource --owning-model=Host v1/host/places Place name:citext style:enum:place_styles:cottage,cabin,lean_to,treehouse,tent,cave,dump sleeps:integer deleted_at:datetime:optional
pnpm psy g:model --no-serializer HostPlace Host:belongs_to Place:belongs_to deleted_at:datetime:optional
pnpm psy g:resource --sti-base-serializer --owning-model=Place v1/host/places/\{\}/rooms Room type:enum:room_types:Bathroom,Bedroom,Kitchen,Den,LivingRoom Place:belongs_to position:integer:optional deleted_at:datetime:optional
pnpm psy g:sti-child --help
pnpm psy g:sti-child Room/Bathroom extends Room bath_or_shower_style:enum:bath_or_shower_styles:bath,shower,bath_and_shower,none
pnpm psy g:sti-child Room/Bedroom extends Room bed_types:enum\[\]:bed_types:twin,bunk,queen,king,cot,sofabed
pnpm psy g:sti-child Room/Kitchen extends Room appliances:enum\[\]:appliance_types:stove,oven,microwave,dishwasher
pnpm psy g:sti-child Room/Den extends Room
pnpm psy g:sti-child Room/LivingRoom extends Room
pnpm psy g:resource --only=update,destroy v1/host/localized-texts LocalizedText localizable_type:enum:localized_types:Host,Place,Room localizable_id:uuid locale:enum:locales:en-US,es-ES title:string markdown:text deleted_at:datetime:optional
pnpm psy g:controller V1/Guest/Places index show
pnpm psy g:migration add-deferrable-unique-constraint-to-rooms
# pending future work
pnpm psy g:resource v1/guest/stays Booking Guest:belongs_to Place:belongs_to arrive_on:date depart_on:date adults:integer cubs:integer deleted_at:date:optional