1
Create a project
Sign in to the Sublay dashboard and create a project. A project is your app’s backend: its own users, its own data, isolated from every other project.When you create it, choose the bundles this guide uses:
entities, comments, reactions and moderation (the comment section’s report button files reports through it). Every project also has core (users and auth). You can add or remove bundles later from the project’s Database page — see Bundles.Copy the project’s ID. You pass it to the SDK in step 3.2
Install the SDK
@sublay/react-js gives you hooks for every Sublay feature. It handles tokens, requests and local state for you.3
Wrap your app in SublayProvider
SublayProvider connects everything inside it to your project. Put your project ID in an environment variable (with Vite, VITE_PUBLIC_SUBLAY_PROJECT_ID in .env):main.tsx
4
Sign users up and in
Sublay has built-in email and password auth. Sublay doesn’t require a username, but the comment section you add in step 7 does, so this form asks for one at sign-up.
useAuth gives you the actions; Sublay creates the user, stores the credentials and starts a session.AuthForm.tsx
useUser returns the signed-in user anywhere in the app; the list in step 6 and the app in the last step use it.More: Built-in auth, useAuth.5
Let a user create an entity
useCreateEntity returns a function that creates an entity. A signed-in user’s entity is theirs: Sublay records them as its author.NewEntityForm.tsx
useCreateEntity.6
List entities
useEntityList loads a paginated list of entities. Each list has a listId of your choosing; here the list shows the newest entities first, with each author’s profile included.Feed.tsx
"hot", "top" or "controversial", and filters by keywords, metadata, author, space, time frame and location. See Entity Lists.7
Open an entity and add comments
Sublay’s comment components install into your project as source files you own. Set up the CLI and add the threaded comment section:The comment section loads the entity’s comments and lets signed-in users post, reply, vote, mention other users, add GIFs (with a Giphy API key), delete their comments and report others’. Sublay stores every comment against the entity, and
init asks for your platform, styling (Tailwind or inline styles) and where to put components (default src/components). See Components for the other components.The entity page loads one entity by its ID with EntityProvider and binds the comment section to the same entity:EntityPage.tsx
commentsCount on the entity stays current.To build your own comment UI instead, use CommentSectionProvider and useCommentSection — see Comments.8
Add a like
useReactionToggle adds and removes the signed-in user’s reaction on an entity or a comment, updating the count on screen right away:LikeButton.tsx
upvote, downvote, like, love, wow, sad, angry and funny. See Reactions.9
Put it together
App shows the sign-in form or the signed-in user, then either the list or the open entity:App.tsx
Before you go to production, add your app’s domain under Settings → Domains → Verified Domains in the dashboard; requests from other web origins are rejected. See Integration Options.
React Native and Expo
Install@sublay/react-native@beta (or @sublay/expo@beta on Expo) instead of @sublay/react-js, and import from it. SublayProvider and every hook in this guide are the same; only your UI components change (View, Text, TextInput, Pressable).
The comment components on React Native and Expo are three pieces your screen places — ThreadedComments, ThreadedCommentSection and ThreadedCommentInput — and they need a gesture handler root. See the components quick start.
Where next
Bundles
The full set of features you can switch on for a project
Spaces
Group users and entities into spaces with membership, roles and rules
Chat
Real-time 1:1 and group conversations
Notifications
In-app notifications for your users
Your own backend
Call Sublay from your server with
@sublay/node and a service keyCustom tables
Store your app’s own data types next to Sublay’s
Users from your own auth
Your app already has users? Sign them in to Sublay with a signed JWT
Entities for records you already have
Give records from your own database a Sublay entity with
foreignId
