Skip to content

Commit 9ff8310

Browse files
committed
refactor: migrate to @roxyapi/sdk and add tests
Replace build-time OpenAPI type generation with the published @roxyapi/sdk client. Request and response types now import directly from the SDK, so there is no checked-in schema to drift against the live spec. - Single createRoxy client with roxy.numerology.* wrappers (the 7 methods screens use) - Drop openapi-fetch, openapi-typescript, and the generate:types script - Drop the EXPO_PUBLIC_ROXYAPI_BASE_URL env key, leaving only the API key - Add jest-expo tests covering success and error paths - README leads with the high-demand numerology endpoints
1 parent 3aa4a99 commit 9ff8310

11 files changed

Lines changed: 11721 additions & 4724 deletions

File tree

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
EXPO_PUBLIC_ROXYAPI_KEY=your_api_key_here

AGENTS.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,40 @@
11
# Agents Guide
22

3-
This is a RoxyAPI starter app. A Pythagorean numerology calculator built with React Native, Expo SDK 54, and TypeScript. Demonstrates Life Path, Expression, Soul Urge, Personal Year, full numerology charts, and compatibility, with Master Number and Karmic Debt detection, all powered by the RoxyAPI Numerology API.
3+
This is a RoxyAPI starter app. A Pythagorean numerology calculator built with React Native, Expo SDK 54, and TypeScript. Demonstrates Life Path, Expression, Soul Urge, Personal Year, full numerology charts, and compatibility, with Master Number and Karmic Debt detection, all powered by the RoxyAPI Numerology API through the official `@roxyapi/sdk`.
44

55
## Setup
66
- Get an API key at https://roxyapi.com/pricing
77
- Create `.env` in the project root with:
88
- `EXPO_PUBLIC_ROXYAPI_KEY=your_api_key_here`
9-
- `EXPO_PUBLIC_ROXYAPI_BASE_URL=https://roxyapi.com/api/v2`
109
- Install with `npm install`
1110
- Run with `npm start`, then `npm run ios`, `npm run android`, or `npm run web`
11+
- Test with `npm test`, typecheck with `npm run typecheck`
1212

13-
## How to call RoxyAPI
14-
- Base URL: `https://roxyapi.com/api/v2`
15-
- Auth header: `X-API-Key: <key>`
13+
## How it calls RoxyAPI
14+
- The only data layer is `@roxyapi/sdk`. `createRoxy(key)` sets the base URL and the auth header, and ships its own types from the OpenAPI spec, so there is no generated schema file to keep in sync.
15+
- The key is bundled into the app (mobile has no server). Treat `EXPO_PUBLIC_ROXYAPI_KEY` as a public, restricted key locked to your bundle id, or proxy calls through a backend you control.
16+
- Numerology takes a name and date of birth only, so there is no geocoding step.
1617
- Live OpenAPI spec: https://roxyapi.com/api/v2/numerology/openapi.json
1718
- Live playground: https://roxyapi.com/api-reference
1819

1920
## Endpoints used in this app
20-
- `GET /numerology/life-path` for the core Life Path number from a birth date
21-
- `GET /numerology/chart` for the full numerology profile, including Expression, Soul Urge, Personality, Birth Day, and Maturity
22-
- `GET /numerology/personal-year` for annual cycle forecasts
23-
- `GET /numerology/expression` for the Expression number from full birth name
24-
- `GET /numerology/compatibility` for compatibility analysis between two people
25-
- `GET /numerology/meanings/{number}` for detailed meanings of numbers 1 to 9 plus Master Numbers 11, 22, 33
21+
- `roxy.numerology.calculateLifePath` for the core Life Path number from a birth date
22+
- `roxy.numerology.generateNumerologyChart` for the full numerology profile, including Expression, Soul Urge, Personality, and Birth Day numbers plus the Personal Year
23+
- `roxy.numerology.calculatePersonalYear` for annual cycle forecasts
24+
- `roxy.numerology.calculateExpression` for the Expression number from full birth name
25+
- `roxy.numerology.calculateSoulUrge` for the Soul Urge number from the vowels in the birth name
26+
- `roxy.numerology.calculateNumCompatibility` for compatibility analysis between two people
27+
- `roxy.numerology.getNumberMeaning` for detailed meanings of numbers 1 to 9 plus Master Numbers 11, 22, 33
2628

2729
## Where to extend
28-
- `src/api/client.ts` is the API client setup.
29-
- `src/api/numerology.ts` exports the methods used by screens.
30-
- `src/api/schema.ts` holds auto generated types from the OpenAPI spec.
30+
- `src/api/client.ts` is the single Roxy SDK client and the `hasApiKey` guard.
31+
- `src/api/numerology.ts` wraps the `roxy.numerology.*` methods used by screens and unwraps the SDK `{ data, error }` result.
32+
- `src/api/types.ts` re-exports the SDK response types under app-friendly names.
3133
- `app/(tabs)/` holds the tab screens: `index.tsx` (Life Path), `chart.tsx`, `personal-year.tsx`, `compatibility.tsx`, `meanings.tsx`.
3234

3335
## Conventions
34-
- All RoxyAPI calls go through `src/api/`. Do not call `fetch` directly from screens.
36+
- All RoxyAPI calls go through `src/api/`. Do not call `fetch` or the SDK directly from screens.
37+
- Method names and body fields come from the SDK types, never invented. Verify against the OpenAPI spec.
3538
- Master Numbers (11, 22, 33) and Karmic Debt numbers (13, 14, 16, 19) are returned by the API. Do not collapse them client side.
3639
- The Pythagorean letter to number mapping is the only system used in this starter.
3740

README.md

Lines changed: 124 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
# RoxyAPI Numerology Starter
1+
# Numerology Starter App
22

3-
A fully functional numerology calculator app built with React Native Expo and TypeScript, powered by the RoxyAPI Numerology API. Calculate Life Path, Expression, Soul Urge, and other core numerology numbers with detailed interpretations.
3+
[![Get API Key](https://img.shields.io/badge/Get_API_Key-roxyapi.com-black?style=for-the-badge)](https://roxyapi.com/pricing)
4+
[![API Docs](https://img.shields.io/badge/API_Docs-Reference-black?style=for-the-badge)](https://roxyapi.com/api-reference#tag/numerology)
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-black?style=for-the-badge)](LICENSE)
6+
7+
Open-source React Native (Expo) template for a Pythagorean numerology app: Life Path, full numerology chart, Personal Year forecast, two-person compatibility, and the full meaning library for numbers 1 to 9 plus Master Numbers 11, 22, and 33. Built on the [Roxy](https://roxyapi.com) Numerology API and the official [@roxyapi/sdk](https://www.npmjs.com/package/@roxyapi/sdk). One API key, every numerology endpoint, full control over your native UI.
8+
9+
Fork it, set one environment variable, and ship.
410

511
## Screenshots
612

@@ -15,197 +21,170 @@ A fully functional numerology calculator app built with React Native Expo and Ty
1521
<img src="screenshots/06.jpeg" width="250" />
1622
</p>
1723

18-
## Features
24+
## What you get
1925

20-
Build a professional numerology app with essential features:
26+
- **Life Path calculator** from a birth date, the single most important number in numerology, with Master Number and Karmic Debt flags.
27+
- **Full numerology chart** in one call: Life Path, Expression, Soul Urge, Personality, and Birth Day numbers plus the current Personal Year.
28+
- **Personal Year forecast** with theme, cycle, opportunities, challenges, and advice for the year ahead.
29+
- **Compatibility** between two people, scored across Life Path, Expression, and Soul Urge with strengths, challenges, and relationship advice.
30+
- **Number meanings** for 1 to 9 and Master Numbers 11, 22, 33, with keywords, strengths, challenges, career, relationships, and spiritual path.
31+
- **Master Number and Karmic Debt detection** returned by the API, never collapsed client side.
32+
- **Dark mode** with a teal theme that follows the device setting.
2133

22-
- **Life Path Calculator**: Calculate the most important numerology number from birth date
23-
- **Full Numerology Chart**: Generate complete numerology profile with all core numbers
24-
- **Personal Year Forecast**: Annual cycle and forecast calculations
25-
- **Compatibility Analysis**: Check numerology compatibility between two people
26-
- **Number Meanings**: Explore detailed meanings for numbers 1-9, 11, 22, and 33
27-
- **Master Numbers**: Automatic detection of Master Numbers (11, 22, 33)
28-
- **Karmic Debt**: Identify Karmic Debt numbers (13, 14, 16, 19)
29-
- **Dark Mode Ready**: Automatic light/dark mode support with teal theme
30-
- **Interactive Number Details**: Tap any number to see full meanings with strengths, challenges, career, relationships, and spiritual insights
34+
## Stack
3135

32-
## Tech Stack
36+
| Technology | Purpose |
37+
|-----------|---------|
38+
| [Expo SDK 54](https://expo.dev) | React Native runtime and build tooling |
39+
| [Expo Router](https://docs.expo.dev/router/introduction/) | File-based navigation with bottom tabs |
40+
| [@roxyapi/sdk](https://www.npmjs.com/package/@roxyapi/sdk) | Fully typed RoxyAPI client. One key, every domain. |
41+
| [NativeWind v4](https://www.nativewind.dev) | Tailwind CSS for React Native |
42+
| [Roxy Numerology API](https://roxyapi.com/products/numerology-api) | Pythagorean numerology, charts, compatibility, and meanings |
3343

34-
- **Expo SDK 54** - React Native development platform
35-
- **Expo Router** - File-based navigation with bottom tabs
36-
- **TypeScript** - Type-safe development
37-
- **NativeWind v4** - Tailwind CSS for React Native styling
38-
- **openapi-fetch** - Type-safe API client
39-
- **Lucide Icons** - Beautiful icons for navigation
40-
- **RoxyAPI Numerology API** - Professional numerology calculations
41-
- **Auto-generated Types** - TypeScript types from OpenAPI schema
44+
## Quick start
4245

43-
## Quick Start
44-
45-
### 1. Clone and Install
46+
### 1. Clone and install
4647

4748
```bash
48-
git clone https://github.com/RoxyAPI/numerology-starter-app
49+
git clone https://github.com/RoxyAPI/numerology-starter-app.git
4950
cd numerology-starter-app
5051
npm install
5152
```
5253

53-
### 2. Get Your API Key
54+
### 2. Get your API key
5455

55-
Visit [roxyapi.com/pricing](https://roxyapi.com/pricing) to sign up and get your API key. RoxyAPI provides professional numerology calculations with:
56+
Get instant access at **[roxyapi.com/pricing](https://roxyapi.com/pricing)**. One key unlocks every numerology endpoint. Add it to `.env`:
5657

57-
- Life Path, Expression, Soul Urge, Personality, Birth Day, Maturity numbers
58-
- Master Number detection (11, 22, 33)
59-
- Karmic Debt and Karmic Lessons analysis
60-
- Personal Year forecasts
61-
- Compatibility calculations
62-
- Comprehensive numerology charts
63-
- Detailed 300-500 word interpretations for every number
58+
```
59+
EXPO_PUBLIC_ROXYAPI_KEY=your-api-key-here
60+
```
6461

65-
### 3. Configure Environment
62+
> **Bundled key caveat.** A mobile app has no server, so any `EXPO_PUBLIC_*` value is compiled into the build and can be read off a device. For production, use a key restricted to your bundle id in the dashboard, or route calls through a thin backend proxy that holds the real key. Never ship an unrestricted key.
6663
67-
Create a `.env` file in the project root:
64+
### 3. Run
6865

69-
```env
70-
EXPO_PUBLIC_ROXYAPI_KEY=your_api_key_here
71-
EXPO_PUBLIC_ROXYAPI_BASE_URL=https://roxyapi.com/api/v2
66+
```bash
67+
npm start # dev server, then press i, a, or w
68+
npm run ios # iOS simulator (macOS only)
69+
npm run android # Android emulator
70+
npm run web # web
7271
```
7372

74-
### 4. Run the App
73+
## How it works
7574

76-
```bash
77-
# Start Expo development server
78-
npm start
75+
The SDK is the only data layer. There is no generated schema file to keep in sync: `@roxyapi/sdk` ships its own types from the same OpenAPI spec the API serves, so a response flows straight into a screen with no glue code. Numerology takes a name and date of birth only, so there is no geocoding step.
7976

80-
# Run on iOS
81-
npm run ios
77+
### One typed client
8278

83-
# Run on Android
84-
npm run android
79+
```ts
80+
// src/api/client.ts
81+
import { createRoxy } from '@roxyapi/sdk';
8582

86-
# Run on web
87-
npm run web
83+
const key = process.env.EXPO_PUBLIC_ROXYAPI_KEY ?? '';
84+
export const roxy = createRoxy(key);
85+
export const hasApiKey = (): boolean => Boolean(key);
8886
```
8987

90-
## Project Structure
88+
### One data layer, screens stay thin
9189

92-
```
93-
numerology-starter-app/
94-
├── app/
95-
│ ├── (tabs)/
96-
│ │ ├── index.tsx # Life Path calculator
97-
│ │ ├── chart.tsx # Full numerology chart
98-
│ │ ├── personal-year.tsx # Personal year forecast
99-
│ │ ├── compatibility.tsx # Compatibility checker
100-
│ │ └── meanings.tsx # Number meanings explorer
101-
│ └── _layout.tsx # Root layout
102-
├── src/
103-
│ ├── api/
104-
│ │ ├── client.ts # API client setup
105-
│ │ ├── numerology.ts # API methods
106-
│ │ ├── schema.ts # Generated types from OpenAPI
107-
│ │ └── types.ts # Type exports
108-
│ ├── components/
109-
│ │ └── RoxyBranding.tsx # API key setup screen
110-
│ └── constants/
111-
│ └── colors.ts # Theme colors
112-
├── assets/ # Logo, icons, images
113-
├── .env # Environment variables
114-
└── package.json
115-
```
116-
117-
## API Endpoints Used
90+
Every screen imports from `src/api`. The data layer wraps each `roxy.numerology.*` call and unwraps the SDK `{ data, error }` result into either the response or one thrown error the screen can catch:
11891

119-
The app demonstrates these RoxyAPI Numerology endpoints:
92+
```ts
93+
// src/api/numerology.ts
94+
export const numerologyApi = {
95+
getLifePath: async (body) => unwrap(await roxy.numerology.calculateLifePath({ body }), 'Failed to calculate Life Path number'),
96+
// ...
97+
};
98+
```
12099

121-
```typescript
122-
// Life Path calculation
123-
POST /life-path
124-
{ year: 1990, month: 7, day: 15 }
100+
```tsx
101+
// app/(tabs)/index.tsx
102+
const data = await numerologyApi.getLifePath({ year: 1990, month: 7, day: 15 });
103+
// data.number, data.type, data.meaning.title
104+
```
125105

126-
// Expression number
127-
POST /expression
128-
{ fullName: "John Smith" }
106+
## Featured endpoints
129107

130-
// Soul Urge number
131-
POST /soul-urge
132-
{ fullName: "John Smith" }
108+
The highest-demand numerology endpoints, in the order you are most likely to ship them. Every method name and field below comes from the [OpenAPI spec](https://roxyapi.com/api/v2/numerology/openapi.json).
133109

134-
// Complete numerology chart
135-
POST /chart
136-
{ fullName: "John Smith", year: 1990, month: 7, day: 15, currentYear: 2026 }
110+
```ts
111+
import { createRoxy } from '@roxyapi/sdk';
137112

138-
// Number meanings
139-
GET /meanings/{number}
113+
const roxy = createRoxy(process.env.EXPO_PUBLIC_ROXYAPI_KEY!);
140114

141-
// And more: /personality, /birth-day, /maturity, /karmic-lessons,
142-
// /karmic-debt, /personal-year, /compatibility
143-
```
115+
// 1. Life Path. The number-one numerology keyword, every calculator page starts here.
116+
const { data: lp } = await roxy.numerology.calculateLifePath({ body: { year: 1990, month: 7, day: 15 } });
117+
// lp.number, lp.type ("single" | "master"), lp.meaning.title
144118

145-
## Type Safety
119+
// 2. Full numerology chart. One shot for all core numbers plus the Personal Year.
120+
const { data: chart } = await roxy.numerology.generateNumerologyChart({
121+
body: { fullName: 'Jane Smith', year: 1990, month: 7, day: 15 },
122+
});
123+
// chart.coreNumbers.lifePath.number, chart.coreNumbers.expression.number, chart.coreNumbers.soulUrge.number
146124

147-
The app uses auto-generated TypeScript types from the RoxyAPI OpenAPI schema:
125+
// 3. Personal Year. Annual forecast, drives the January traffic spike.
126+
const { data: pyear } = await roxy.numerology.calculatePersonalYear({ body: { month: 7, day: 15, year: 2026 } });
127+
// pyear.personalYear, pyear.theme, pyear.forecast
148128

149-
```bash
150-
# Regenerate types when API updates
151-
npm run generate:types
152-
```
129+
// 4. Compatibility. Two-person scoring across Life Path, Expression, and Soul Urge.
130+
const { data: compat } = await roxy.numerology.calculateNumCompatibility({
131+
body: { person1: { fullName: 'Jane Smith', year: 1990, month: 7, day: 15 }, person2: { fullName: 'John Doe', year: 1992, month: 3, day: 22 } },
132+
});
133+
// compat.overallScore, compat.rating
153134

154-
Types are automatically generated from:
135+
// 5. Number meanings. Cache once for 1 to 9 plus Master Numbers 11, 22, 33.
136+
const { data: meaning } = await roxy.numerology.getNumberMeaning({ path: { number: '11' } });
137+
// meaning.number, meaning.meaning.title, meaning.meaning.description
155138
```
156-
https://roxyapi.com/api/v2/numerology/openapi.json
157-
```
158-
159-
## Styling
160139

161-
Built with **NativeWind v4** (Tailwind CSS for React Native):
140+
This template uses 7 of the numerology endpoints. Browse the rest in the [API reference](https://roxyapi.com/api-reference#tag/numerology).
162141

163-
- `className="text-3xl font-bold text-zinc-900 dark:text-white"` - Tailwind classes
164-
- Automatic dark mode with `dark:` prefix
165-
- Teal brand color (`teal-600`)
166-
- Zinc gray scale for text and backgrounds
142+
## Project structure
167143

168-
## Building for Production
169-
170-
### iOS
171-
172-
```bash
173-
eas build --platform ios
174144
```
175-
176-
### Android
177-
178-
```bash
179-
eas build --platform android
145+
app/ # Expo Router screens
146+
├── _layout.tsx # Root Stack
147+
└── (tabs)/
148+
├── _layout.tsx # Bottom tabs
149+
├── index.tsx # Life Path calculator
150+
├── chart.tsx # Full numerology chart
151+
├── personal-year.tsx # Personal Year forecast
152+
├── compatibility.tsx # Two-person compatibility
153+
└── meanings.tsx # Number meanings explorer
154+
src/
155+
├── api/
156+
│ ├── client.ts # The one Roxy SDK client + hasApiKey guard
157+
│ ├── numerology.ts # Wraps roxy.numerology.*, unwraps { data, error }
158+
│ ├── types.ts # SDK response types under app-friendly names
159+
│ └── index.ts # Barrel export
160+
├── components/
161+
│ ├── NumberDetailModal.tsx # Full meaning sheet for a tapped number
162+
│ └── RoxyBranding.tsx
163+
├── constants/colors.ts # appColors for React Native props
164+
└── hooks/useUserId.ts # Stable device id in AsyncStorage
180165
```
181166

182-
Requires [Expo Application Services (EAS)](https://expo.dev/eas) account.
167+
## Customize
183168

184-
## Customization Tips
169+
- **Add a feature.** Pick a numerology method, add a wrapper in `src/api/numerology.ts`, call it from a screen. The SDK types regenerate from the spec, so new endpoints flow through with no manual typing. The API also ships Personality, Birth Day, Maturity, Karmic Lessons, Karmic Debt, Personal Day, and Personal Month.
170+
- **Change the theme.** This app uses Tailwind colors through NativeWind. Swap `teal-600` in the screen `className` strings for any Tailwind color, and update `appColors.primary` in `src/constants/colors.ts` for the React Native props.
171+
- **Save profiles.** Use AsyncStorage to keep a calculated chart on device. RoxyAPI stores no birth data, so memory is your layer to own.
185172

186-
1. **Add more calculators**: The API supports Expression, Soul Urge, Personality, Maturity, Karmic Lessons, and more
187-
2. **Enhance UI**: Add animations with Reanimated, charts with Victory Native
188-
3. **Save calculations**: Use AsyncStorage to save user's numerology profile
189-
4. **Share results**: Add share functionality for calculated numbers
190-
5. **Multi-language**: The API returns English interpretations - add i18n for UI text
191-
6. **Custom colors**: Modify `src/constants/colors.ts` and Tailwind config
173+
## Why Roxy
192174

193-
## Learn More
175+
- **Breadth.** Numerology plus Western astrology, Vedic astrology, tarot, biorhythm, I Ching, crystals, dreams, and angel numbers under one key.
176+
- **Type-safe.** The SDK types come from one OpenAPI pipeline, so response shapes cannot drift from what the API returns.
177+
- **Eight languages.** Pass `query: { lang }` on the numerology endpoints for interpretations in English, Hindi, Turkish, Spanish, German, Portuguese, French, or Russian.
178+
- **Remote MCP.** Connect AI agents to every numerology endpoint at `roxyapi.com/mcp/numerology`, no local setup.
194179

195-
- **API Documentation**: [roxyapi.com/docs](https://roxyapi.com/docs)
196-
- **OpenAPI Schema**: [roxyapi.com/api/v2/numerology/openapi.json](https://roxyapi.com/api/v2/numerology/openapi.json)
197-
- **Pricing**: [roxyapi.com/pricing](https://roxyapi.com/pricing)
198-
- **Expo Documentation**: [docs.expo.dev](https://docs.expo.dev)
180+
## Links
199181

200-
## Support
201-
202-
- API Documentation: [roxyapi.com/docs](https://roxyapi.com/docs)
203-
- Get API Key: [roxyapi.com/pricing](https://roxyapi.com/pricing)
182+
- [Numerology API](https://roxyapi.com/products/numerology-api)
183+
- [API reference and playground](https://roxyapi.com/api-reference#tag/numerology)
184+
- [Get API key](https://roxyapi.com/pricing)
185+
- [All templates](https://roxyapi.com/starters)
186+
- [Connect AI agents via MCP](https://roxyapi.com/docs/mcp)
204187

205188
## License
206189

207-
MIT - Feel free to use this starter for your own numerology app projects.
208-
209-
---
210-
211-
**Built with ❤️ using [RoxyAPI](https://roxyapi.com) - Professional APIs for developers**
190+
MIT

env.example

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)