https://github.com/azimonti/progressive-web-app-template-2
A Progressive Web Application (PWA) template featuring local file management and optional Dropbox / Google Drive integration.
https://github.com/azimonti/progressive-web-app-template-2
dropbox-sdk progressive-web-app pwa react vite
Last synced: 2 months ago
JSON representation
A Progressive Web Application (PWA) template featuring local file management and optional Dropbox / Google Drive integration.
- Host: GitHub
- URL: https://github.com/azimonti/progressive-web-app-template-2
- Owner: azimonti
- License: mit
- Created: 2025-10-07T01:54:25.000Z (9 months ago)
- Default Branch: master
- Last Pushed: 2025-10-07T06:49:52.000Z (9 months ago)
- Last Synced: 2025-10-07T08:39:42.493Z (9 months ago)
- Topics: dropbox-sdk, progressive-web-app, pwa, react, vite
- Language: TypeScript
- Homepage:
- Size: 305 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Agents: AGENTS.md
Awesome Lists containing this project
README
# Progressive Web App Template
A modern **Progressive Web App (PWA)** template built with **Vite**, **React**, **TypeScript**, and **Tailwind CSS v4**.
Designed for fast startup, clean structure, and zero config overhead β ideal for creating installable, offline-capable web apps.
---
## π Stack
| Tool | Purpose |
|------|----------|
| [Vite](https://vite.dev) | Lightning-fast development and build tooling |
| [React](https://react.dev) | UI library |
| [TypeScript](https://www.typescriptlang.org/) | Static typing |
| [Tailwind CSS v4](https://tailwindcss.com/) | Utility-first CSS framework (no config required) |
| [pnpm](https://pnpm.io/) | Fast, disk-efficient package manager |
---
## π§© Features
- β‘ Instant startup with Vite
- π¨ Tailwind CSS v4 (config-free setup)
- π± PWA-ready: add manifest and service worker easily
- π§± TypeScript-first React components
- π₯ Hot Module Replacement (HMR) out of the box
- π§Ό Clean, flat project structure (no unnecessary scaffolding)
- β¨ **Font Awesome** icons ready to use across the UI (brands + solid packs)
- βοΈ **Full cloud storage integration** with Dropbox and Google Drive
- π Secure OAuth authentication (PKCE for Dropbox, Google Identity Services for Drive)
- π Automatic file synchronization between local and cloud storage
- βοΈ Intelligent conflict resolution for local vs. remote files
- π Storage quota management (5MB per file, 50MB total)
- π Token refresh and persistent authentication
- π Cross-platform file access and backup
---
## π οΈ Setup
```bash
# Install dependencies
pnpm install
# Start development server
pnpm dev
# Build for production
pnpm build
# Preview production build
pnpm preview
````
Open [http://localhost:5173](http://localhost:5173) in your browser.
### UI Icons with Font Awesome
- Font Awesome core is configured in `src/main.tsx` (`config.autoAddCss = false`) and styles are imported once via `@fortawesome/fontawesome-svg-core/styles.css`.
- Import icons directly where they are used, e.g.
```tsx
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faDropbox } from '@fortawesome/free-brands-svg-icons';
```
- The template already uses brand icons for the cloud provider dropdown and solid icons for toast notifications and chevrons. Add additional icons on a per-component basisβno central icon registry is necessary.
### Optional: Cloud Sync
The template can mirror saved files to a cloud provider. Once configured, use the dropdown in the UI to choose Dropbox or Google Drive and connect.
#### Dropbox
1. Create a scoped Dropbox app in the [Dropbox App Console](https://www.dropbox.com/developers/apps) requesting these permissions: `files.metadata.read`, `files.metadata.write`, `files.content.read`, `files.content.write`.
2. Add your development URL (e.g. `http://localhost:5173/`) to the app's redirect URIs.
3. Open `src/services/CloudConfig.ts` and set `DROPBOX_APP_KEY` to your Dropbox app key.
4. Start the app (`pnpm dev`) and click **Connect Dropbox** to complete the OAuth flow. The redirect URI automatically matches the current origin (e.g. `http://localhost:5173/` or your production URL), so make sure each is added to your Dropbox app configuration.
#### Google Drive
1. Create or reuse a Google Cloud project and [enable the Drive API](https://console.cloud.google.com/apis/library/drive.googleapis.com).
2. Configure an OAuth 2.0 **Web application** client ID in the Google Cloud Console. Add your dev and production URLs (e.g. `http://localhost:5173/`) to **Authorized JavaScript origins** and **Authorized redirect URIs**.
3. Open `src/services/CloudConfig.ts` and set `GOOGLE_DRIVE_CLIENT_ID` to your Google OAuth client ID.
4. (Optional) Adjust `GOOGLE_DRIVE_FOLDER_NAME` in the same file if you want a different target folder.
5. Start the app (`pnpm dev`) and click **Connect Google Drive**. Sign in with an account that has access to the Drive API for the project.
Synced files are created inside a Drive folder named after `GOOGLE_DRIVE_FOLDER_NAME` (defaults to `pwa-template`) at the root of the user's Drive, so they can be managed manually if needed.
---
## π¦ Directory Structure
```
.
βββ index.html
βββ postcss.config.js
βββ tsconfig.json
βββ tsconfig.app.json
βββ tsconfig.node.json
βββ vite.config.ts
βββ eslint.config.js
βββ firebase.json
βββ .firebaserc
βββ public/
β βββ manifest.webmanifest
β βββ sw.js
β βββ img/
β βββ social-card.jpg
β βββ icons/
β βββ pwa-template-32x32.png
β βββ pwa-template-180x180.png
β βββ pwa-template-192x192.png
β βββ pwa-template-512x512-maskable.png
β βββ pwa-template-512x512.png
β βββ pwa-template.ico
βββ src/
β βββ App.tsx
β βββ main.tsx
β βββ index.css
β βββ i18n.ts
β βββ components/
β β βββ ConfirmationDialog.tsx
β β βββ LanguageSwitcher.tsx
β β βββ Toast.tsx
β βββ locales/
β β βββ en.json
β β βββ ja.json
β βββ services/
β βββ CloudConfig.ts
β βββ CloudStorage.ts
β βββ DropboxAuthService.ts
β βββ DropboxStorageService.ts
β βββ FileStorageService.ts
β βββ GoogleDriveAuthService.ts
β βββ GoogleDriveStorageService.ts
βββ package.json
```
---
## π§° PWA Notes
To make this a full PWA:
1. Add a `manifest.webmanifest` in the project root.
2. Register a service worker (e.g., using [Workbox](https://developer.chrome.com/docs/workbox)).
3. Configure Viteβs [PWA plugin](https://vite-pwa-org.netlify.app/).
Example minimal service worker:
```ts
self.addEventListener('install', () => self.skipWaiting());
self.addEventListener('fetch', () => {});
```
---
## π§βπ» Author
**Marco Azimonti**
[https://github.com/azimonti](https://github.com/azimonti)
---
## πͺͺ License
This project is licensed under the [MIT License](./LICENSE).