A Python Flask-based GUI for browsing and editing Google Cloud Datastore entities running on the local Google Cloud Datastore emulator.
- π Browse Entities: View all entity kinds/tables in your local datastore
- π Paginated Views: Handle large datasets with pagination
- βοΈ Edit Entities: Modify entity properties with validation and type preservation
- β Create Entities: Add new entities with custom properties
- ποΈ Delete Entities: Remove entities with confirmation
- π¨ Modern UI: Clean, responsive Bootstrap interface
- π§ JSON Support: Handle complex data types (objects, arrays)
- π Multi-Project Support: Switch between different GCP projects in the emulator
- π Dynamic Project Discovery: Automatically detect available projects with data
- πΎ Type Preservation: Maintains correct data types (boolean, datetime, blob, etc.)
- π Easy Setup: Simple configuration for local development
- Google Cloud SDK installed
- Python 3.7+
- Google Cloud Datastore Emulator
-
Clone or download this project to your local machine
-
Run the startup script (recommended):
./start.sh
This will automatically:
- Create a virtual environment if it doesn't exist
- Activate the virtual environment
- Install Python dependencies
- Start the datastore emulator and Flask app
-
Or install manually:
# Create and activate virtual environment python3 -m venv venv source venv/bin/activate # Install dependencies pip install -r requirements.txt
-
Set up environment variables (optional):
cp .env.example .env # Edit .env if you need to change default settings
-
Install the emulator (if not already installed):
gcloud components install cloud-datastore-emulator
-
Start the emulator:
gcloud beta emulators datastore start --data-dir=./datastore-data --host-port=localhost:8081
This will:
- Start the emulator on
localhost:8081 - Store data in
./datastore-datadirectory - Keep data persistent between restarts
- Start the emulator on
-
Set environment variables (in a new terminal):
$(gcloud beta emulators datastore env-init)
-
Using the startup script (recommended):
./start.sh
This will handle everything: virtual environment setup, dependencies, emulator startup, and Flask app.
-
Or start manually:
# Activate virtual environment source venv/bin/activate # Start datastore emulator (in one terminal) gcloud beta emulators datastore start --data-dir=./datastore-data --host-port=localhost:8081 # Start Flask app (in another terminal) export DATASTORE_EMULATOR_HOST=localhost:8081 export GOOGLE_CLOUD_PROJECT=test-project python app.py
-
Open your browser and navigate to:
http://localhost:5000
The browser supports working with multiple GCP projects in the same emulator instance:
- Project Dropdown: Click the project dropdown in the navigation bar to see available projects
- Switch Projects: Select a different project to browse its entities
- Add New Project: Click "Add New Project" to manually add a project by name
- Refresh Projects: Click "Refresh Projects" to rescan the emulator for projects with data
- Auto-Discovery: The system automatically detects projects that contain entities
The application maintains your selected project in the session and will remember it as you browse.
- Home Page: Shows all available entity kinds/tables
- Kind Browser: Click on any kind to view its entities
- Pagination: Use the pagination controls to navigate large datasets
- Search: Browse through entities with built-in pagination
- Navigate to a kind or create a new one
- Click "New Entity" button
- Add properties using the dynamic form
- Specify entity ID (optional - will auto-generate if empty)
- Use JSON format for complex data types
- Click the edit button (pencil icon) on any entity
- Modify properties in the form
- Add or remove properties as needed
- Save changes or cancel
The browser supports all standard Datastore data types with proper type preservation:
- Strings: Plain text values
- Numbers: Integers and floats (123, 45.67)
- Booleans: true/false with checkbox interface
- Datetime: ISO 8601 format with timezone preservation (2025-10-27T14:30:00-04:00)
- Blob/Bytes: Binary data with base64 encoding/decoding
- Arrays: JSON arrays [1, 2, 3] or ["a", "b", "c"]
- Objects: JSON objects {"key": "value", "nested": {"data": 123}}
- Null: null values
Type Preservation Features:
- Boolean fields use checkboxes with dynamic True/False labels
- Datetime fields preserve timezone information
- Blob fields handle binary data via base64 encoding
- All types are correctly stored and retrieved from the datastore
String:
Hello World
Number:
42
3.14159
Boolean:
true
false
Array:
[1, 2, 3, 4, 5]
["apple", "banana", "cherry"]
[{"name": "John", "age": 30}, {"name": "Jane", "age": 25}]Object:
{
"name": "John Doe",
"age": 30,
"address": {
"street": "123 Main St",
"city": "Anytown",
"zipcode": "12345"
},
"hobbies": ["reading", "swimming", "coding"]
}The application can be configured via environment variables in the .env file:
# Datastore emulator settings
DATASTORE_EMULATOR_HOST=localhost:8081
GOOGLE_CLOUD_PROJECT=your-project-name # Default project (can be changed via UI)
# Flask settings
FLASK_ENV=development
FLASK_DEBUG=TrueNote: The GOOGLE_CLOUD_PROJECT setting defines the default project when the app starts. You can switch between projects using the project dropdown in the UI without restarting the application.
local_datastore_browser/
βββ app.py # Main Flask application
βββ requirements.txt # Python dependencies
βββ .env # Environment variables
βββ README.md # This file
βββ templates/ # HTML templates
βββ base.html # Base template
βββ index.html # Home page
βββ browse_kind.html # Entity listing
βββ view_entity.html # Entity details
βββ edit_entity.html # Entity editor
βββ new_entity.html # Entity creator
If you can't connect to the datastore:
-
Check emulator status:
gcloud beta emulators datastore start --data-dir=./datastore-data
-
Verify environment variables:
echo $DATASTORE_EMULATOR_HOST echo $GOOGLE_CLOUD_PROJECT
-
Check the port: Make sure port 8081 is not in use by another process
If no entities appear:
- Check the selected project: Use the project dropdown to switch to the correct project
- Refresh projects: Click "Refresh Projects" in the dropdown to rescan for available projects
- Create test data using the Google Cloud SDK or the included test data script:
# Set environment for emulator $(gcloud beta emulators datastore env-init) # Run the test data creator (if available) python create_test_data.py
- Verify project ID: Ensure you're viewing the correct project where your data exists
If you get import errors:
-
Install dependencies:
pip install -r requirements.txt
-
Check Python version: Ensure you're using Python 3.7+
The application also provides a simple REST API:
GET /api/kinds- Returns list of all entity kinds
To contribute or modify the application:
-
Install development dependencies:
pip install -r requirements.txt
-
Enable debug mode in
.env:FLASK_DEBUG=True
-
Modify templates in the
templates/directory -
Update routes in
app.py
This application is designed for local development only. Do not use in production without proper authentication and security measures.
This project is provided as-is for educational and development purposes.