Repository navigation
Contributing
billisdead edited this page Jun 24, 2026
·
2 revisions
Screens are created in the app/ folder following Expo Router conventions.
Naming convention:
- One file = one screen. The filename determines the route.
- Groups (tabs, modals) use the
(group)/notation — parentheses are excluded from the URL. - Layouts are named
_layout.tsx.
Example: adding a post detail screen
Create app/post/[id].tsx. Expo Router automatically generates the route /post/:id. Read the parameter with useLocalSearchParams().
// app/post/[id].tsx
import { useLocalSearchParams } from 'expo-router';
export default function PostDetailScreen() {
const { id } = useLocalSearchParams<{ id: string }>();
// ...
}Rules:
- No calls to
ghostClientfrom a screen — go through the store or a hook. - No business logic in
_layout.tsxlayouts. - Native Alerts (irreversible confirmation) belong in hooks or screen callbacks, never in stores.
All actions follow the same pattern in Zustand stores.
Basic pattern:
// In postStore.ts or instanceStore.ts
async myNewAction(param: string): Promise<void> {
set({ isLoading: true, error: null });
try {
const result = await someApiFunction(param);
set({ myData: result, isLoading: false });
} catch (error) {
console.error('myNewAction error:', error instanceof Error ? error.message : error);
set({
isLoading: false,
error: error instanceof Error ? error.message : 'Unexpected error.',
});
throw error; // Re-throw if the caller needs to react
}
}Rules:
- Always set
isLoading: trueat the start of an async action. - Always log errors with
console.error— without sensitive data (never an API key). - Always store the error message in
state.errorso components can display it. - Never mutate
statedirectly — produce a new object inset(). - Actions in
instanceStorethat modify persisted data must callpersistState()or the SecureStore setters.
All endpoints are defined in src/api/ghostClient.ts.
Steps:
- Add the response type in
src/api/ghostTypes.tsif needed.
// In ghostTypes.ts
export interface GhostNewResourceResponse {
resource: {
id: string;
// ...
};
}- Add the function in
ghostClient.ts:
// In ghostClient.ts
/**
* Description of what the endpoint does.
* @param id - Parameter description
* @returns Description of the returned value
* @throws GhostApiError if the API returns an error
*/
export async function getNewResource(id: string): Promise<GhostNewResourceType> {
const response = await client.get<GhostNewResourceResponse>(
`/ghost/api/admin/new-resource/${id}/`,
);
return response.data.resource;
}- Call the function from the store (never directly from a screen).
Rules:
- Each exported function must have a complete JSDoc (description,
@param,@returns,@throws). - HTTP errors are already normalized by the response interceptor — do not handle 401/409/422/429 in individual functions.
- For an endpoint that bypasses interceptors (like
testGhostConnection), handle errors explicitly in the function.
Commits follow the Conventional Commits format in English:
type(scope): concise description in imperative present tense
Types:
| Type | Usage |
|---|---|
feat |
New feature |
fix |
Bug fix |
refactor |
Refactoring without behavior change |
docs |
Documentation only |
chore |
Maintenance (dependencies, config, scripts) |
style |
Formatting, CSS/StyleSheet styles |
test |
Adding or modifying tests |
Examples:
feat(compose): add keyboard-aware scroll on editor screen
fix(ghostClient): handle 503 upstream Ghost errors
docs(GHOST_API): add rate limiting section
chore(deps): upgrade jose to 5.9.6
Rules:
- No direct commits to
main— always via a PR/MR on Gitea. - Description does not exceed 72 characters.
- The commit body (optional, after a blank line) can contain context and rationale.
- No secrets or API key fragments in commit messages.
Ghostposter
Setup
Reference
Project