Giter VIP home page Giter VIP logo

nextjs-gcp-storage's Introduction

Next.js + GCP Storage Upload

This is an example of a Next.js application allowing you to upload photos to a GCP storage bucket.

Getting Started

Option 1: Use an existing storage bucket.

Retrieve your existing project ID, bucket name, and service account email and private key. Provide those values after clicking "Deploy" to automatically set the environment variables.

Deploy with Vercel

Option 2: Create a new bucket.

  1. Download the Google Cloud SDK so you can use the gcloud CLI.
  2. Run gcloud auth login.
  3. Inside Google Cloud, create a new project nextjs-storage-bucket.
  4. Run gcloud config set project nextjs-storage-bucket.
  5. Run gcloud auth application-default login, per setup instructions.
  6. Run pulumi up to deploy your bucket (it will prompt you to log in).
  7. View your newly created bucket and add the bucket name to .env.local (see .env.example).
  8. Create a new service account with a role of Storage Object Creator.
  9. Click "Create Key" and save the JSON file.
  10. Add the project_id, client_email, and private_key to .env.local (see .env.example).
  11. Run yarn dev to start the Next app at localhost:3000.
  12. Choose a .png or .jpg file.
  13. You should see your file successfully uploaded to the bucket.

Commands

  • yarn dev โ€“ Starts the Next.js app at localhost:3000.
  • pulumi up โ€“ Deploy this stack to GCP.

nextjs-gcp-storage's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.