Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jedwards1230/mychat
ChatGPT Clone built with React Native and Fastify
https://github.com/jedwards1230/mychat
fastify openai openapi react-native
Last synced: about 1 month ago
JSON representation
ChatGPT Clone built with React Native and Fastify
- Host: GitHub
- URL: https://github.com/jedwards1230/mychat
- Owner: jedwards1230
- License: mit
- Created: 2024-03-27T19:48:57.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-05-15T09:51:48.000Z (7 months ago)
- Last Synced: 2024-05-15T15:38:59.180Z (7 months ago)
- Topics: fastify, openai, openapi, react-native
- Language: TypeScript
- Homepage:
- Size: 37.7 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# myChat
ChatGPT clone. Definitely a WIP. This project was mostly to learn React Native and Fastify.
## Tooling
### Server
- Fastify
- Serve client as a SPA React app
- Schema validation with `zod`
- Auto-generated OpenAPI docs served at `/docs`
- TypeORM & Postgres
- OpenAI API### Client
- React Native and Expo
- Server state management with `@tanstack/react-query`
- Theming with `nativewind` and `tailwindcss`
- Reusable UI components with `@radix-ui`### Deployment
There are two Compose files. They pull from `jewards1230/mychat` on Docker Hub. There is a Github Action that builds and pushes the image on every push to the `main` branch.
These can be modified for local build contexts, but I generally only use docker for the local Postgres DB.
#### Compose.yml
- Docker Compose will serve:
- Fastify server with static web client on port 3000
- Postgres DB
- This is mostly used for local development and testing#### Production.yml
- Docker Compose will serve the same as above, plus:
- Tailscale Proxy that serves the Fastify server to the web with SSL
- This is nice because it gives the app its own machine on the Tailscale network.
- This exposes the Fastify server on port 443
- This requires copying the funnel.json file to the appropriate directory when configuring Docker Compose variables
- This can be reconfigured to use the Tailscale Serve service as well.#### Development
- The Dockerfile compiles the main backend and serves a Postgres DB.
- Note: Generally best to just run the PG DB alone and run fastify form the CLI
- TODO: Add dev mode so docker watches for changes and restarts the server.
- Run `yarn run export` from the `./client` directory to export the web client to the `./client/dist` directory. The Dockerfile has an ENV variable to point to this directory.## Features
### Server
- Database stores all chats and user data
- Optional JSON/stream response for chats
- Route schema validation
- OpenAPI spec (runs on `/docs` while server is running)
- Thread queue system### Client
- Responsive Web view
- Native build (only tested iOS)
- Chat with the default agent. CRUD your messages and threads.
- Light/dark themes
- Create new agents
- Stream chat responses
- Upload files and inject text into message
- iOS: Native screens/routing
- iOS: Native context menus