A custom Pub package repository server built with Dart and using PocketBase as the database backend.
This implementation follows the Pub Repository Specification v2.
- Fully compliant with Pub Repository Specification v2
- Package publishing and version management
- Authentication with Bearer tokens
- Package storage and distribution
- Security advisories support
- Dart SDK 3.0.0 or higher
-
Clone this repository:
git clone https://github.com/your-username/pocketpub.git cd pocketpub -
Install dependencies:
dart pub get -
Download PocketBase:
# This will download PocketBase and set up the data directory ./start_pocketbase.sh
-
Start PocketBase (in a separate terminal):
./start_pocketbase.sh -
Visit http://localhost:8090/_/ to set up your admin account.
- Default admin email:
[email protected] - Default admin password:
password123
- Default admin email:
-
Start the PocketPub server:
./run_server.sh -
The Pub server will be available at http://localhost:8080
For quicker development without dependency on PocketBase:
./run_dev_server.sh
This runs the server with mock data, making development easier.
-
To stop PocketBase:
./stop_pocketbase.sh -
To stop the Dart server, press Ctrl+C in the terminal where it's running.
-
Configure your package to use this server in
pubspec.yaml:name: your_package version: 1.0.0 publish_to: http://localhost:8080
-
Generate and add a token:
dart pub token add http://localhost:8080 -
Publish your package:
dart pub publish
Add this to your pubspec.yaml:
dependencies:
some_package:
hosted:
name: some_package
url: http://localhost:8080
version: ^1.0.0You can configure the server using environment variables:
-
Copy the sample environment file:
cp sample.env .env -
Edit
.envto customize your settings:POCKETBASE_URL: URL of your PocketBase instancePOCKETBASE_ADMIN: Admin email for PocketBasePOCKETBASE_PASSWORD: Admin password for PocketBaseSTORAGE_DIR: Directory to store package archivesPORT: Port for the pub serverDEV_MODE: Set totruefor development modeSKIP_POCKETBASE: Set totrueto run without PocketBase
bin/server.dart- Main server entry pointlib/pocketpub.dart- Core library exportslib/src/api/- API handlers for pub server endpointslib/src/db/- PocketBase database integrationpocketbase_data/- PocketBase data files
See POCKETBASE_SETUP.md for details on PocketBase configuration.
MIT