Package Exports
- bootstrap-supabase-provider
Readme
Bootstrap Supabase Provider ๐
Let users connect their Supabase project via a Bootstrap modal โ no backend setup required. โจ
Installation ๐ฆ
1. Via npm (recommended) ๐
npm install bootstrap-supabase-provider@1.0.4
Then add this to your HTML:
<script type="importmap">
{
"imports": {
"bootstrap-supabase-provider": "./node_modules/bootstrap-supabase-provider/bootstrap-supabase-provider.js"
}
}
</script>2. 2. Via CDN ๐
<script type="importmap">
{
"imports": {
"bootstrap-supabase-provider": "https://cdn.jsdelivr.net/npm/bootstrap-supabase-provider@1.0.4"
}
}
</script>Usage ๐ฏ
import { bootstrapSupabaseProvider} from "https://cdn.jsdelivr.net/npm/bootstrap-supabase-provider@1.0.4";
// Basic Config - Opens a modal and asks user for Supabase details ๐ง
const { supabase, url, anonKey } = await bootstrapSupabaseProvider();
// Example query ๐
const { data, error } = await supabase.from("todos").select("*");
console.log(data, error);
// Always Show Modal - even if user has provided configuration before ๐
const config1 = await bootstrapSupabaseProvider({ show: true });
// Custom Labels and Help ๐จ
const config2 = await bootstrapSupabaseProvider({
title: "Connect to Database",
urlLabel: "Database URL",
keyLabel: "API Key",
buttonLabel: "Connect",
help: '<div class="alert alert-info">Get your credentials from <a href="https://supabase.com/dashboard">Supabase Dashboard</a></div>',
});
// Custom Storage - store in sessionStorage ๐พ
const config3 = await bootstrapSupabaseProvider({
storage: sessionStorage,
key: "mySupabaseConfig"
});
API ๐
async function bootstrapSupabaseProvider({
storage: localStorage, // where to store config, e.g. sessionStorage ๐พ
key: "bootstrapSupabaseProvider_config", // key name for storage ๐
show: false, // true will force prompt even if config exists ๐๏ธ
help: "", // HTML rendered at top of modal ๐ก
title: "Supabase Configuration", // modal dialog title ๐
urlLabel: "Supabase URL", // URL input label ๐
keyLabel: "Supabase Anon Key", // API key input label ๐
buttonLabel: "Connect to Supabase", // submit button label ๐
})
// Returns: { supabase, url, anonKey } โ
Development ๐จโ๐ป
git clone https://github.com/Nitin399-maker//bootstrap-supabase-provider.git
cd bootstrap-supabase-provider
npm installTo test locally: ๐งช
<script type="module" src="./bootstrap-supabase-provider.js"></script>To publish: ๐ค
npm login
npm publish --access publicDesign Decisions
- Design Decisions ๐ฏ
- Simple zero-build ES module ๐ฆ
- Bootstrap modal UX for quick setup โก
- LocalStorage-based persistence ๐พ
- Works seamlessly in browsers ๐
License
MIT License ยฉ 2025 Nitin Kumar โจ