Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oconr/apptyped
Create fully typed SDKs for Appwrite based on your collections
https://github.com/oconr/apptyped
appwrite sdk typescript
Last synced: 5 days ago
JSON representation
Create fully typed SDKs for Appwrite based on your collections
- Host: GitHub
- URL: https://github.com/oconr/apptyped
- Owner: oconr
- License: bsd-3-clause
- Created: 2024-02-14T04:06:27.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-02-28T17:35:04.000Z (8 months ago)
- Last Synced: 2024-10-10T19:22:31.965Z (26 days ago)
- Topics: appwrite, sdk, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/apptyped
- Size: 80.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Apptyped
This is a package that creates a fully typed SDK based on your Appwrite collections
> Install using `npm install apptyped`
- Create `.env` with the following:
- `APPWRITE_ENDPOINT` - The endpoint of your Appwrite instance
- `APPWRITE_PROJECT_ID` - The ID of your Appwrite project
- `APPWRITE_API_KEY` - An Appwrite API key is required to generate the types from your collections as well as using the server-side client
- Run `npx apptyped g` to generate the fully typed SDK> This SDK is compatible with Appwrite server version 1.4.x
### Example
```typescript
// Import location will depend on if you're using it for server-side or client-side
// Server-side SDK import
import { Databases, Client } from 'apptyped/server'
// Client-side SDK import
import { Databases, Client } from 'apptyped/client';const client = new Client();
// Databases will return as an object of all your collections which can be access as shown below
const { BlogPosts } = new Databases(client);// Fully typed queries can be accessed from .q of each collection
const data = await BlogPosts.list([
BlogPosts.q.equal("published", true),
]);
```