supermemory/apps/web
2024-05-18 17:48:49 -05:00
..
db added wipefile 2024-04-14 00:48:37 -07:00
public more meta tags 2024-04-13 23:48:14 -07:00
src added browser rendering 2024-05-18 17:48:49 -05:00
types space expand layout 2024-04-15 00:02:37 +05:30
.eslintrc.json extension styling such that website content is not affected https://twitter.com/DhravyaShah/status/1778189224396922948 2024-04-10 15:36:51 -07:00
.gitignore add wrangler.toml to gitignore 2024-04-02 07:55:42 +00:00
components.json extension styling such that website content is not affected https://twitter.com/DhravyaShah/status/1778189224396922948 2024-04-10 15:36:51 -07:00
drizzle.config.ts update store route 2024-04-13 06:23:40 +05:30
env.d.ts added ratelimits 2024-04-11 20:15:10 -07:00
next.config.mjs ignore eslint and ts build errors 2024-04-19 12:59:47 +05:30
package.json fix favicons 2024-04-13 20:49:56 +05:30
postcss.config.js EVERYTHING WORKING PERFECTLY 2024-02-26 17:53:38 -07:00
README.md extension styling such that website content is not affected https://twitter.com/DhravyaShah/status/1778189224396922948 2024-04-10 15:36:51 -07:00
tailwind.config.ts notess 2024-04-11 05:57:42 +00:00
tsconfig.json fix: hot update in dev mode! FINALLY 2024-03-30 14:50:42 -07:00
wrangler.toml added readme 2024-04-14 17:15:43 -07:00

This is a Next.js project bootstrapped with c3.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

Cloudflare integration

Besides the dev script mentioned above c3 has added a few extra scripts that allow you to integrate the application with the Cloudflare Pages environment, these are:

  • pages:build to build the application for Pages using the @cloudflare/next-on-pages CLI
  • preview to locally preview your Pages application using the Wrangler CLI
  • deploy to deploy your Pages application using the Wrangler CLI

Note: while the dev script is optimal for local development you should preview your Pages application as well (periodically or before deployments) in order to make sure that it can properly work in the Pages environment (for more details see the @cloudflare/next-on-pages recommended workflow)

Bindings

Cloudflare Bindings are what allows you to interact with resources available in the Cloudflare Platform.

You can use bindings during development, when previewing locally your application and of course in the deployed application:

  • To use bindings in dev mode you need to define them in the next.config.js file under setupDevBindings, this mode uses the next-dev @cloudflare/next-on-pages submodule. For more details see its documentation.

  • To use bindings in the preview mode you need to add them to the pages:preview script accordingly to the wrangler pages dev command. For more details see its documentation or the Pages Bindings documentation.

  • To use bindings in the deployed application you will need to configure them in the Cloudflare dashboard. For more details see the Pages Bindings documentation.

KV Example

c3 has added for you an example showing how you can use a KV binding.

In order to enable the example:

  • Search for javascript/typescript lines containing the following comment:
    // KV Example:
    
    and uncomment the commented lines below it.
  • Do the same in the wrangler.toml file, where the comment is:
    # KV Example:
    
  • If you're using TypeScript run the build-cf-types script to update the env.d.ts file:
    npm run build-cf-types
    # or
    yarn build-cf-types
    # or
    pnpm build-cf-types
    # or
    bun build-cf-types
    

After doing this you can run the dev or preview script and visit the /api/hello route to see the example in action.

Finally, if you also want to see the example work in the deployed application make sure to add a MY_KV_NAMESPACE binding to your Pages application in its dashboard kv bindings settings section. After having configured it make sure to re-deploy your application.