-
Notifications
You must be signed in to change notification settings - Fork 0
Create app #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
adityaoberai
wants to merge
16
commits into
main
Choose a base branch
from
dev
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Create app #1
Changes from 12 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d71c4ba
create app
adityaoberai 7df4cec
remove initial draft rules file
adityaoberai 4181a43
Add multitenancy guideline to rules generator
adityaoberai ad12780
Add Apple and Android SDK support to rules generator; update installa…
adityaoberai 50a1829
Update Dart SDK installation instructions and enhance Qwik security n…
adityaoberai 8684766
Change "real-time" to "realtime"
adityaoberai 90b5005
update favicon to appwrite logo
adityaoberai 0d05102
Add MCP section to rules generator and update package.json with Next.…
adityaoberai d2ef717
Enhance README with detailed features and usage instructions for Appw…
adityaoberai db0f222
Integrate permission examples into rules generator documentation; enh…
adityaoberai 5d7e367
Add API endpoints for SDK listing and rule generation
adityaoberai 9c347b5
Replace "document" with "row" and "collection" with "table"
adityaoberai 404442e
Remove outdated common product links
adityaoberai 1b2f159
Remove redundant authentication documentation link from common produc…
adityaoberai 3a5ceb0
Remove unnecessary JSDoc comment from SDK server route
adityaoberai 2cfc254
Refactor rules generator functions to remove unnecessary parameters
adityaoberai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| node_modules | ||
|
|
||
| # Output | ||
| .output | ||
| .vercel | ||
| .netlify | ||
| .wrangler | ||
| /.svelte-kit | ||
| /build | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # Env | ||
| .env | ||
| .env.* | ||
| !.env.example | ||
| !.env.test | ||
|
|
||
| # Vite | ||
| vite.config.js.timestamp-* | ||
| vite.config.ts.timestamp-* | ||
|
|
||
| # Rules | ||
|
|
||
| *.mdc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| engine-strict=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Package Managers | ||
| package-lock.json | ||
| pnpm-lock.yaml | ||
| yarn.lock | ||
| bun.lock | ||
| bun.lockb | ||
|
|
||
| # Miscellaneous | ||
| /static/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "useTabs": true, | ||
| "singleQuote": true, | ||
| "trailingComma": "none", | ||
| "printWidth": 100, | ||
| "plugins": [ | ||
| "prettier-plugin-svelte" | ||
| ], | ||
| "overrides": [ | ||
| { | ||
| "files": "*.svelte", | ||
| "options": { | ||
| "parser": "svelte" | ||
| } | ||
| } | ||
| ] | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,225 @@ | ||
| # Appwrite Cursor Rules Generator | ||
|
|
||
| A web application for generating comprehensive Cursor rules (`.mdc` files) for Appwrite development across multiple SDKs and frameworks. This tool helps developers create customized development rules that include best practices, code examples, and guidance for building applications with Appwrite. | ||
|
|
||
| ## Features | ||
|
|
||
| - **Multi-SDK Support**: Generate rules for JavaScript/TypeScript, Python, PHP, Go, Flutter/Dart, Apple, Android, Swift, Kotlin, Ruby, .NET, and React Native | ||
| - **Framework-Specific Rules**: Get tailored rules for popular frameworks like Next.js, React, Vue, Svelte, Angular, Astro, Nuxt, Qwik, Solid, and more | ||
| - **Feature Selection**: Choose which Appwrite features to include: | ||
| - Authentication & Teams | ||
| - Database Operations | ||
| - Storage Operations | ||
| - Functions | ||
| - Messaging | ||
| - Sites | ||
| - Realtime Subscriptions | ||
| - MCP (Model Context Protocol) recommendations | ||
| - **Export Options**: Copy to clipboard or download as `.mdc` file | ||
| - **Best Practices**: Generated rules include comprehensive best practices, multi-tenancy patterns, and security guidelines | ||
|
|
||
| ## Supported SDKs and Frameworks | ||
|
|
||
| | SDK | Frameworks | | ||
| |-----|------------| | ||
| | JavaScript/TypeScript | Next.js, React, Vue, Svelte, Angular, Astro, Nuxt, Qwik, Solid, TanStack, Node.js, Vanilla | | ||
| | React Native | React Native, Vanilla | | ||
| | Python | Flask, Django, FastAPI, Server | | ||
| | Flutter/Dart | Flutter, Server | | ||
| | Apple | Vanilla | | ||
| | Android | Vanilla | | ||
| | Swift | Server, Vanilla | | ||
| | Kotlin | Server, Vanilla | | ||
| | PHP | Laravel, Symfony, Server | | ||
| | Go | Gin, Fiber, Server | | ||
| | Ruby | Rails, Server | | ||
| | .NET | ASP.NET, Server, Vanilla | | ||
|
|
||
| ## Getting Started | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Node.js 18+ | ||
| - pnpm | ||
|
|
||
| ### Installation | ||
|
|
||
| 1. Clone the repository: | ||
| ```bash | ||
| git clone <repository-url> | ||
| cd appwrite-cursor-rules | ||
| ``` | ||
|
|
||
| 2. Install dependencies: | ||
| ```bash | ||
| pnpm install | ||
| ``` | ||
|
|
||
| 3. Start the development server: | ||
| ```bash | ||
| pnpm dev | ||
| ``` | ||
|
|
||
| 4. Open your browser and navigate to `http://localhost:5173` (or the port shown in the terminal) | ||
|
|
||
| ## Usage | ||
|
|
||
| 1. **Select SDK**: Choose your preferred Appwrite SDK from the dropdown | ||
| 2. **Select Framework**: Pick the framework you're using (options depend on the selected SDK) | ||
| 3. **Choose Features**: Check the boxes for the Appwrite features you want to include in your rules | ||
| 4. **Generate Rules**: Click the "Generate Rules" button | ||
| 5. **Export**: Copy the rules to your clipboard or download as a `.mdc` file | ||
|
|
||
| The generated rules file can be used in Cursor IDE to provide AI-assisted development guidance specific to your Appwrite setup. | ||
|
|
||
| ## API Endpoints | ||
|
|
||
| The application exposes REST API endpoints for programmatic access to rule generation. | ||
|
|
||
| ### Get Available SDKs and Frameworks | ||
|
|
||
| **GET** `/api/sdks` | ||
|
|
||
| Returns a list of all available SDKs, their frameworks, and available features. | ||
|
|
||
| **Response:** | ||
| ```json | ||
| { | ||
| "sdks": [ | ||
| { | ||
| "id": "javascript", | ||
| "name": "JavaScript/TypeScript", | ||
| "frameworks": ["nextjs", "react", "vue", ...], | ||
| "importSyntax": "import", | ||
| "exportSyntax": "export", | ||
| "asyncSyntax": "async/await" | ||
| }, | ||
| ... | ||
| ], | ||
| "availableFeatures": ["auth", "database", "storage", "functions", "messaging", "sites", "realtime"] | ||
| } | ||
| ``` | ||
|
|
||
| ### Generate Rules | ||
|
|
||
| **GET** `/api/rules` | ||
|
|
||
| Generate rules using query parameters. | ||
|
|
||
| **Query Parameters:** | ||
| - `sdk` (required): SDK identifier (e.g., `javascript`, `python`, `go`) | ||
| - `framework` (required): Framework identifier (e.g., `nextjs`, `react`, `flask`) | ||
| - `features` (optional): Comma-separated list of features (default: `auth`) | ||
| - Available: `auth`, `database`, `storage`, `functions`, `messaging`, `sites`, `realtime` | ||
| - Special: `all` - includes all available features | ||
| - `mcp` (optional): Include MCP recommendations (`true` or `false`, default: `false`) | ||
| - `format` (optional): Response format (`text` or `json`, default: `text`) | ||
|
|
||
| **Example:** | ||
| ```bash | ||
| # Get rules as markdown text | ||
| curl "http://localhost:5173/api/rules?sdk=javascript&framework=nextjs&features=auth,database&format=text" | ||
|
|
||
| # Get all features | ||
| curl "http://localhost:5173/api/rules?sdk=javascript&framework=nextjs&features=all" | ||
|
|
||
| # Get rules as JSON | ||
| curl "http://localhost:5173/api/rules?sdk=python&framework=flask&features=auth,storage&format=json" | ||
| ``` | ||
|
|
||
| **Response (format=text):** | ||
| - Content-Type: `text/markdown; charset=utf-8` | ||
| - Returns the generated rules as markdown text | ||
| - Includes `Content-Disposition` header for file download | ||
|
|
||
| **Response (format=json):** | ||
| ```json | ||
| { | ||
| "sdk": "javascript", | ||
| "framework": "nextjs", | ||
| "features": ["auth", "database"], | ||
| "includeMCP": false, | ||
| "rules": "---\ndescription: You are an expert developer...\n---\n\n# Appwrite Development Rules\n..." | ||
| } | ||
| ``` | ||
|
|
||
| **Error Responses:** | ||
| - `400 Bad Request`: Invalid SDK or framework | ||
| - `500 Internal Server Error`: Server error during rule generation | ||
|
|
||
| **Example Usage:** | ||
|
|
||
| ```javascript | ||
| // Fetch rules using fetch API | ||
| const response = await fetch('/api/rules?sdk=javascript&framework=nextjs&features=auth,database'); | ||
| const rules = await response.text(); | ||
|
|
||
| // Get all features as JSON | ||
| const response = await fetch('/api/rules?sdk=javascript&framework=nextjs&features=all&format=json'); | ||
| const data = await response.json(); | ||
| console.log(data.rules); | ||
| ``` | ||
|
|
||
| ## Development | ||
|
|
||
| ### Available Scripts | ||
|
|
||
| - `pnpm dev` - Start development server | ||
| - `pnpm build` - Build for production | ||
| - `pnpm preview` - Preview production build | ||
| - `pnpm check` - Run Svelte type checking | ||
| - `pnpm lint` - Run ESLint and Prettier | ||
| - `pnpm format` - Format code with Prettier | ||
| - `pnpm generate:nextjs` - Generate Next.js rules file (example script) | ||
|
|
||
| ### Project Structure | ||
|
|
||
| ``` | ||
| appwrite-cursor-rules/ | ||
| ├── src/ | ||
| │ ├── lib/ | ||
| │ │ ├── languages/ # SDK and framework-specific code examples | ||
| │ │ │ ├── js/ # JavaScript/TypeScript frameworks | ||
| │ │ │ ├── python/ # Python frameworks | ||
| │ │ │ ├── common/ # Shared rules (products, MCP, etc.) | ||
| │ │ │ └── ... # Other SDKs | ||
| │ │ ├── rules-generator.js # Main rules generation logic | ||
| │ │ └── utils/ # Utility functions | ||
| │ └── routes/ | ||
| │ ├── api/ | ||
| │ │ ├── rules/ | ||
| │ │ │ └── +server.js # API endpoint for generating rules | ||
| │ │ └── sdks/ | ||
| │ │ └── +server.js # API endpoint for listing SDKs | ||
| │ ├── +page.svelte # Main application page | ||
| │ └── +layout.svelte # Layout component | ||
| ├── scripts/ | ||
| │ ├── generate-nextjs-rules.js # Example script for generating rules | ||
| │ └── lib-loader.js # Module loader for scripts | ||
| └── static/ # Static assets | ||
| ``` | ||
|
|
||
| ### Adding New SDKs or Frameworks | ||
|
|
||
| 1. Create a new file in `src/lib/languages/[sdk-name]/index.js` (or add to existing SDK directory) | ||
| 2. Export framework-specific initialization code | ||
| 3. Add the SDK configuration to `SDK_OPTIONS` in `src/lib/rules-generator.js` | ||
| 4. Export the SDK module in `src/lib/languages/index.js` | ||
|
|
||
| ### Adding New Features | ||
|
|
||
| 1. Create a new section generator function in `src/lib/rules-generator.js` (e.g., `generateNewFeatureSection`) | ||
| 2. Add the feature to the features array in `src/routes/+page.svelte` | ||
| 3. Include the feature in the `generateRules` function's Promise.all array | ||
|
|
||
| ## Generated Rules Format | ||
|
|
||
| The generated rules follow the Cursor `.mdc` format and include: | ||
|
|
||
| - **Frontmatter**: Metadata about the rules (description, alwaysApply flag) | ||
| - **SDK Initialization**: Framework-specific code examples for setting up Appwrite | ||
| - **Feature Sections**: Best practices and guidance for selected features | ||
| - **Multi-Tenancy Guide**: Comprehensive guide on using teams and permissions | ||
| - **Product Links**: Links to official Appwrite documentation | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import { fileURLToPath } from 'node:url'; | ||
| import { includeIgnoreFile } from '@eslint/compat'; | ||
| import js from '@eslint/js'; | ||
| import svelte from 'eslint-plugin-svelte'; | ||
| import { defineConfig } from 'eslint/config'; | ||
| import globals from 'globals'; | ||
| import ts from 'typescript-eslint'; | ||
| import svelteConfig from './svelte.config.js'; | ||
|
|
||
| const gitignorePath = fileURLToPath(new URL('./.gitignore', import.meta.url)); | ||
|
|
||
| export default defineConfig( | ||
| includeIgnoreFile(gitignorePath), | ||
| js.configs.recommended, | ||
| ...ts.configs.recommended, | ||
| ...svelte.configs.recommended, | ||
| { | ||
| languageOptions: { | ||
| globals: { ...globals.browser, ...globals.node } | ||
| }, | ||
| rules: { // typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects. | ||
| // see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors | ||
| "no-undef": 'off' } | ||
| }, | ||
| { | ||
| files: [ | ||
| '**/*.svelte', | ||
| '**/*.svelte.ts', | ||
| '**/*.svelte.js' | ||
| ], | ||
| languageOptions: { | ||
| parserOptions: { | ||
| projectService: true, | ||
| extraFileExtensions: ['.svelte'], | ||
| parser: ts.parser, | ||
| svelteConfig | ||
| } | ||
| } | ||
| } | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| { | ||
| "name": "appwrite-cursor-rules", | ||
| "private": true, | ||
| "version": "0.0.1", | ||
| "type": "module", | ||
| "scripts": { | ||
| "dev": "vite dev", | ||
| "build": "vite build", | ||
| "preview": "vite preview", | ||
| "prepare": "svelte-kit sync || echo ''", | ||
| "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", | ||
| "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", | ||
| "format": "prettier --write .", | ||
| "lint": "prettier --check . && eslint .", | ||
| "generate:nextjs": "node --loader ./scripts/lib-loader.js scripts/generate-nextjs-rules.js" | ||
| }, | ||
| "devDependencies": { | ||
| "@eslint/compat": "^1.4.0", | ||
| "@eslint/js": "^9.39.1", | ||
| "@sveltejs/adapter-auto": "^7.0.0", | ||
| "@sveltejs/kit": "^2.48.5", | ||
| "@sveltejs/vite-plugin-svelte": "^6.2.1", | ||
| "@types/node": "^22", | ||
| "eslint": "^9.39.1", | ||
| "eslint-plugin-svelte": "^3.13.0", | ||
| "globals": "^16.5.0", | ||
| "prettier": "^3.6.2", | ||
| "prettier-plugin-svelte": "^3.4.0", | ||
| "svelte": "^5.43.8", | ||
| "svelte-check": "^4.3.4", | ||
| "typescript": "^5.9.3", | ||
| "typescript-eslint": "^8.47.0", | ||
| "vite": "^7.2.2" | ||
| }, | ||
| "dependencies": { | ||
| "@appwrite.io/pink": "^1.0.0" | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align
/api/sdksresponse example with actual API (availableFeaturesincludes"all").src/routes/api/sdks/+server.jsreturnsavailableFeaturesincluding the special"all"value, but the README example omits it. This can confuse API consumers about the supportedfeaturesvalues.Consider updating the example to include
"all":🤖 Prompt for AI Agents