MCPcopy Index your code
hub / github.com/edgestorejs/edgestore

github.com/edgestorejs/edgestore @v0.5.7

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.5.7 ↗ · + Follow
409 symbols 1,253 edges 253 files 5 documented · 1% updated 4d ago@edgestore/shared@0.7.0 · 2026-01-26★ 4513 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Docs

Check the official documentation for more information.

Quick Start

Next.js Setup

Install

Let's start by installing the required packages.

npm install @edgestore/server @edgestore/react zod

Environment Variables

Then go to your Dashboard, create a new project and copy the keys to your environment variables.

```shell title=".env" EDGE_STORE_ACCESS_KEY=your-access-key EDGE_STORE_SECRET_KEY=your-secret-key


### Backend

Now we can create the backend code for our Next.js app.


EdgeStore is compatible with both types of Next.js apps (`pages router` and `app router`).

The example below is the simplest bucket you can create with EdgeStore. Just a simple file bucket with no validation that will be accessible by anyone with the link.

You can have multiple buckets in your app, each with its own configuration.

```ts title="src/app/api/edgestore/[...edgestore]/route.ts"
import { initEdgeStore } from '@edgestore/server';
import { createEdgeStoreNextHandler } from '@edgestore/server/adapters/next/app';

const es = initEdgeStore.create();

/**
 * This is the main router for the EdgeStore buckets.
 */
const edgeStoreRouter = es.router({
  publicFiles: es.fileBucket(),
});

const handler = createEdgeStoreNextHandler({
  router: edgeStoreRouter,
});

export { handler as GET, handler as POST };

/**
 * This type is used to create the type-safe client for the frontend.
 */
export type EdgeStoreRouter = typeof edgeStoreRouter;

Frontend

Now let's initiate our context provider.

```tsx title="src/lib/edgestore.ts" 'use client';

import { createEdgeStoreProvider } from '@edgestore/react'; import { type EdgeStoreRouter } from '../app/api/edgestore/[...edgestore]/route';

const { EdgeStoreProvider, useEdgeStore } = createEdgeStoreProvider();

export { EdgeStoreProvider, useEdgeStore };


And then wrap our app with the provider.

```tsx title="src/app/layout.tsx"
import { EdgeStoreProvider } from '../lib/edgestore';
import './globals.css';

// ...

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <body>
        <EdgeStoreProvider>{children}</EdgeStoreProvider>
      </body>
    </html>
  );
}

Upload file

You can use the useEdgeStore hook to access a typesafe frontend client and use it to upload files.

import * as React from 'react';
import { useEdgeStore } from '../lib/edgestore';

export default function Page() {
  const [file, setFile] = React.useState<File>();
  const { edgestore } = useEdgeStore();

  return (



      <input
        type="file"
        onChange={(e) => {
          setFile(e.target.files?.[0]);
        }}
      />
      <button
        onClick={async () => {
          if (file) {
            const res = await edgestore.publicFiles.upload({
              file,
              onProgressChange: (progress) => {
                // you can use this to show a progress bar
                console.log(progress);
              },
            });
            // you can run some server action or api here
            // to add the necessary data to your database
            console.log(res);
          }
        }}
      >
        Upload
      </button>



  );
}

Replace file

By passing the replaceTargetUrl option, you can replace an existing file with a new one. It will automatically delete the old file after the upload is complete.

You can also upload the file using the same file name, but in that case, you might still see the old file for a while because of the CDN cache.

const res = await edgestore.publicFiles.upload({
  file,
  options: {
    replaceTargetUrl: oldFileUrl,
  },
  // ...
});

Delete file

await edgestore.publicFiles.delete({
  url: urlToDelete,
});

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Function 340
Interface 38
Class 16
Method 15

Languages

TypeScript100%

Modules by API surface

packages/shared/src/internals/bucketBuilder.ts17 symbols
packages/server/src/adapters/shared.ts17 symbols
docs/src/components/ui/dropdown-menu.tsx15 symbols
packages/react/src/createNextProxy.ts13 symbols
docs/src/app/(main)/(home)/_components/responsive-tabs.tsx13 symbols
packages/server/src/core/client/index.ts11 symbols
packages/server/src/core/sdk/index.ts10 symbols
docs/src/app/(main)/(home)/_components/select.tsx10 symbols
scripts/analyzeSizeChange.ts9 symbols
packages/server/src/providers/azure/index.ts9 symbols
packages/server/src/providers/aws/index.ts9 symbols
packages/server/src/libs/logger.ts8 symbols

For agents

$ claude mcp add edgestore \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page