En brugervenlig webapplikation til personlig registrering af erhvervskørsel for enkeltmandsvirksomheder med VSO-ordning.
Projektet bruger en enkel og effektiv teknologisk tilgang:
- Vite som build tool for hurtig udvikling og optimerede builds
- Vanilla JavaScript med moderne ES modules for klar struktur uden framework overhead
- CSS Custom Properties for konsistent styling og themeing
- Google APIs for authentication, maps og sheets integration
- Responsive Design med fokus på mobilbrug
korebogsapp/
├── src/
│ ├── js/
│ │ ├── auth.js # Google OAuth implementering
│ │ ├── maps.js # Google Maps integration
│ │ ├── storage.js # Local storage og Google Sheets
│ │ └── ui.js # UI håndtering
│ ├── main.js # App initialisering
│ └── style.css # Styling
├── index.html # Hoved-HTML
├── callback.html # OAuth callback-håndtering
├── vite.config.js # Vite konfiguration
└── package.json # Afhængigheder
- Google OAuth login
- Automatisk afstandsberegning via Google Maps
- Synkronisering med Google Sheets
- Lokal lagring af data
- Mobil-optimeret brugergrænseflade
- Offline-understøttelse med synkronisering ved genetableret forbindelse
- Redigering og sletning af kørselsregistreringer
- Node.js (v14 or newer)
- npm or yarn
- Google Cloud Platform account with Maps JavaScript API and OAuth 2.0 credentials
-
Clone the repository:
git clone https://github.com/transportrefer/korebogsapp.git cd korebogsapp -
Install dependencies:
npm install
-
Configure environment variables:
- Create a
.envfile in the root directory - Add your Google API keys (never commit this file to git):
VITE_GOOGLE_CLIENT_ID=your-client-id-here VITE_GOOGLE_API_KEY=your-api-key-here - Create a
-
Start the development server:
npm run dev
- Go to Google Cloud Console
- Create a new project or use an existing one
- Enable the Google Maps JavaScript API and Places API
- Create an API key
- Important: Apply restrictions to your API key:
- Under "Application restrictions", select "Website restrictions"
- Add your domain (e.g.,
https://yourdomain.com/*orhttp://localhost:*for development) - Under "API restrictions", restrict the key to only the APIs you need:
- Maps JavaScript API
- Places API
- Distance Matrix API
- Geocoding API
- In the Google Cloud Console, navigate to "APIs & Services" > "Credentials"
- Create an OAuth 2.0 Client ID
- Configure the OAuth consent screen
- Add authorized JavaScript origins:
https://yourdomain.com(production)http://localhost:5173(development)
- Add authorized redirect URIs:
https://yourdomain.com/callback.html(production)http://localhost:5173/callback.html(development)
- Update the
.env.productionfile with your production API keys (these will be included in the build) - Make sure your API keys have proper restrictions to prevent unauthorized usage
- Run the deployment script:
npm run deploy
- Never commit API keys to your repository
- Always use environment variables for sensitive information
- Apply appropriate restrictions to your API keys
- For production, use a CI/CD pipeline with secrets management
- Regularly review your Google Cloud Console for any unusual activity
Dette projekt er udviklet som et personligt værktøj og er ikke licenceret til kommerciel brug uden tilladelse.