https://github.com/odisseu93/file-storage-node
Example of a backend created to save, retrieve and delete files in Google Cloud Storage, using Node.js, Express and the Firebase SDK.
https://github.com/odisseu93/file-storage-node
back-end bun file-storage google-cloud image-storage multer prisma sqlite typescript
Last synced: about 1 year ago
JSON representation
Example of a backend created to save, retrieve and delete files in Google Cloud Storage, using Node.js, Express and the Firebase SDK.
- Host: GitHub
- URL: https://github.com/odisseu93/file-storage-node
- Owner: Odisseu93
- License: mit
- Created: 2024-11-05T19:33:52.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-09T19:13:18.000Z (over 1 year ago)
- Last Synced: 2025-01-28T22:51:18.959Z (about 1 year ago)
- Topics: back-end, bun, file-storage, google-cloud, image-storage, multer, prisma, sqlite, typescript
- Language: TypeScript
- Homepage:
- Size: 82 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# File storage
Backend for uploading, downloading and deleting files on Google Cloud.
## Environment variables
```bash
API_URL="http://localhost:8080"
SERVICE_ACCOUNT_CREDENTIALS_PATH="./path_to_my_credential/credentials.json"
# Firebase environment variables
# https://firebase.google.com/docs/app-distribution/authenticate-service-account?platform=ios
API_KEY="my_api_key"
AUTH_DOMAIN="my_domain"
DATABASE_URL="my_database_url"
PROJECT_ID="firebase_project_id"
STORAGE_BUCKET="my-bucket.com"
MESSAGING_SENDER_ID="0000000"
APP_ID="id:00dsfdsljkjadslfkj"
```
## Running locally
**Bun (JavaScript runtime and toolkit)**: [installation link](https://bun.sh/)
To install project dependencies:
```bash
bun install
```
**[Prisma (ORM)](https://www.prisma.io/docs/getting-started)**
Apply prisma migrations:
```bash
# https://www.prisma.io/docs/orm/prisma-client/deployment/deploy-database-changes-with-prisma-migrate
npx prisma migrate deploy
```
Generate Prisma Client
```bash
# https://www.prisma.io/docs/orm/prisma-client/deployment/deploy-database-changes-with-prisma-migrate
npx prisma generate
```
To Run
```bash
bun run
```
## Some important links
- [Multer NPM package](https://www.npmjs.com/package/multer)
- [Firebase - Authenticate with a service account](https://firebase.google.com/docs/app-distribution/authenticate-service-account?platform=ios)
- [Firebase Admin SDK](https://firebase.google.com/docs/admin/setup)
- [Google cloud - Streaming-downloads](https://cloud.google.com/storage/docs/streaming-downloads)
- [Google cloud - Upload objects from memory](https://cloud.google.com/storage/docs/uploading-objects-from-memory)
- [Google cloud - Create a GET-signed URL](https://cloud.google.com/storage/docs/samples/storage-generate-signed-url-v4)
## License
[MIT](./LICENSE.md)
## Developer