{"id":25339884,"url":"https://github.com/cipherstash/jseql-next-drizzle","last_synced_at":"2025-08-21T00:13:13.856Z","repository":{"id":273572599,"uuid":"907133047","full_name":"cipherstash/jseql-next-drizzle","owner":"cipherstash","description":"Trusted data access example with CipherStash, Turborepo, Next.js, Vercel, Clerk, Drizzle ORM, and Supabase.","archived":false,"fork":false,"pushed_at":"2025-07-09T18:10:13.000Z","size":169,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-23T13:50:31.670Z","etag":null,"topics":["data-security","encryption","postgresql"],"latest_commit_sha":null,"homepage":"https://jseql.ciphersta.sh","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cipherstash.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-22T22:34:23.000Z","updated_at":"2025-01-24T00:39:58.000Z","dependencies_parsed_at":"2025-01-21T18:29:01.726Z","dependency_job_id":"318dcab3-3c5e-416a-8f85-1c4fe47a73a9","html_url":"https://github.com/cipherstash/jseql-next-drizzle","commit_stats":null,"previous_names":["cipherstash/jseql-next-drizzle"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cipherstash/jseql-next-drizzle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cipherstash%2Fjseql-next-drizzle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cipherstash%2Fjseql-next-drizzle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cipherstash%2Fjseql-next-drizzle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cipherstash%2Fjseql-next-drizzle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cipherstash","download_url":"https://codeload.github.com/cipherstash/jseql-next-drizzle/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cipherstash%2Fjseql-next-drizzle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271406002,"owners_count":24753893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-security","encryption","postgresql"],"created_at":"2025-02-14T07:43:24.983Z","updated_at":"2025-08-21T00:13:13.839Z","avatar_url":"https://github.com/cipherstash.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jseql demo app \n\nThis project uses the following technologies:\n\n- [Turborepo](https://turborepo.org) for monorepo management\n- [pnpm](https://pnpm.io) for package management\n- [Next.js](https://nextjs.org) for the application framework\n- [Clerk](https://clerk.com) for auth\n- [Vercel](https://vercel.com) for hosting\n- [Supabase](https://supabase.com) for database\n- [Drizzle ORM](https://drizzle.org) for database access\n- [CipherStash](https://cipherstash.com) for data encryption\n- [jseql](https://github.com/cipherstash/jseql) for interacting with CipherStash Encrypt\n\n## Getting Started\n\nFirst, install dependencies:\n\n```bash\npnpm install\n```\n\nSecond, create a `.env.local` file in the root directory with the following content:\n\n```bash\n# Clerk auth\nNEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=\nCLERK_SECRET_KEY=\n\n# Supabase postgres connection string\nPOSTGRES_URL=\n\n# CipherStash encryption and access keys\nCS_CLIENT_ID=\nCS_CLIENT_KEY=\nCS_CLIENT_ACCESS_KEY=\nCS_WORKSPACE_ID=\n```\n\nFinally, run the development server:\n\n```bash\npnpm run dev\n```\n\nOpen [http://localhost:3000](http://localhost:3000) with your browser to see the result.\n\n## Database\n\nThe database is hosted on Supabase and has the following schema which is defined using the Drizzle ORM:\n\n```ts\n// Data that is encrypted using jseql is stored as jsonb in postgres\n\nexport const users = pgTable(\"users\", {\n\tid: serial(\"id\").primaryKey(),\n\tname: varchar(\"name\").notNull(),\n\temail: jsonb(\"email\").notNull(),\n\trole: varchar(\"role\").notNull(),\n});\n```\n\n\u003e [!NOTE]\n\u003e This example does not include any searchable encrypted fields.\n\u003e If you want to search on encrypted fields, you will need to install EQL.\n\u003e The EQL library ships with custom types that are used to define encrypted fields.\n\u003e See the [EQL documentation](https://github.com/cipherstash/encrypted-query-language) for more information.\n\n## @cipherstash/jseql\n\nAll the email data is encrypted using jseql and CipherStash.\nThe cipherstext is stored in the `email` column of the `users` table.\nThe application is configured to only decrypt the data when the user is signed in, otherwise it will display the encrypted data.\n\n### Npm package\n\n`@cipherstash/jseql` uses custom Rust bindings in order to perform encryptions and decryptions.\nWe leverage the [Neon project](https://neon-rs.dev/) to provide a JavaScript API for these bindings.\n\n### Encryption\n\nThere is a helper script which will insert records into the database:\n\n```bash\npnpm tsx packages/core/helpers/insert.ts --name 'user_name' --email 'user_email' \n```\n\nThis will insert a record into the database with an encrypted email field.\n\n### Decryption\n\nTo view the decrpytion implementation, see the `getUsers` function in [src/app/page.tsx](src/app/page.tsx).\n\n### Next.js\n\nSince `@cipherstash/jseql` is a native Node.js module, you need to opt-out from the Server Components bundling and use native Node.js `require` instead.\n\n#### Using version 15 or later\n\n`next.config.ts` [configuration](https://nextjs.org/docs/app/api-reference/config/next-config-js/serverExternalPackages):\n\n```js\nconst nextConfig = {\n  ...\n  serverExternalPackages: ['@cipherstash/jseql'],\n}\n```\n\n#### Using version 14\n\n`next.config.mjs` [configuration](https://nextjs.org/docs/14/app/api-reference/next-config-js/serverComponentsExternalPackages):\n\n```js\nconst nextConfig = {\n  ...\n  experimental: {\n    serverComponentsExternalPackages: ['@cipherstash/jseql'],\n  },\n}\n```\n\n## Package manager\n\n\u003e [!NOTE]\n\u003e At the time of this writing, some Node-API functions are not implemented so this environment may not work with [Bun](https://bun.sh).\n\nSee the [.npmrc](.npmrc) in the root of the project which contains the following contents. This is requires when @cipherstash/jseql is a nested dependency of your application:\n\n```txt\npublic-hoist-pattern[]=*@cipherstash/jseql*\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcipherstash%2Fjseql-next-drizzle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcipherstash%2Fjseql-next-drizzle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcipherstash%2Fjseql-next-drizzle/lists"}