Skip to content

Commit 12a3bec

Browse files
j7nw4rclaude
andcommitted
docs: rewrite README with professional format
- Concise structure with tables for features and status - Updated quick start example with PostgreSQL 15 requirement - Added installation section with dev-dependencies - Removed emojis and unnecessary content 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent e46a8a7 commit 12a3bec

File tree

1 file changed

+56
-71
lines changed

1 file changed

+56
-71
lines changed

README.md

Lines changed: 56 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,35 @@
1-
# Supabase-Testcontainers
1+
# supabase-testcontainers-modules
22

3-
> ⚠️ **Development Status**: This crate is currently under active development and is not yet ready for production use. APIs may change significantly between versions.
3+
Testcontainers modules for Supabase services in Rust. Run real Supabase containers in your integration tests.
44

5-
A Rust implementation of [Testcontainers](https://github.com/testcontainers/testcontainers-rs) for [Supabase](https://supabase.com/) services. This crate provides utilities for setting up and managing Supabase services in a containerized environment, primarily for testing purposes.
5+
> **Note**: This crate is under active development. APIs may change between versions.
66
77
## Installation
88

9-
Add this to your `Cargo.toml`:
10-
11-
```toml
12-
[dependencies]
13-
supabase-testcontainers-modules = "0.1.0"
14-
```
15-
16-
Or with specific features:
17-
189
```toml
1910
[dependencies]
2011
supabase-testcontainers-modules = { version = "0.1.0", features = ["auth"] }
21-
```
22-
23-
## Features
2412

25-
- `analytics` - Enables the Supabase Analytics service container support
26-
- `auth` - Enables the Supabase Auth service container support
27-
- `const` - Provides constant values used throughout the crate
28-
- `error` - Enables error handling functionality
29-
- `functions` - Enables the Edge Functions service container support
30-
- `graphql` - Enables the GraphQL (pg_graphql) service container support
31-
- `postgrest` - Enables the PostgREST service container support
32-
- `postgres_testcontainer` - Enables PostgreSQL container support
33-
- `realtime` - Enables the Realtime service container support
34-
- `storage` - Enables the Storage service container support
35-
36-
## Usage
37-
38-
### Auth with PostgreSQL
13+
[dev-dependencies]
14+
testcontainers = "0.23"
15+
testcontainers-modules = { version = "0.11", features = ["postgres"] }
16+
tokio = { version = "1", features = ["full"] }
17+
```
3918

40-
The Auth service requires PostgreSQL. Here's a complete example:
19+
## Quick Start
4120

4221
```rust
4322
use supabase_testcontainers_modules::{Auth, AUTH_PORT, DOCKER_INTERNAL_HOST, LOCAL_HOST};
44-
use testcontainers::runners::AsyncRunner;
23+
use testcontainers::{runners::AsyncRunner, ImageExt};
4524
use testcontainers_modules::postgres::Postgres;
4625

47-
#[tokio::main]
48-
async fn main() -> anyhow::Result<()> {
49-
// 1. Start PostgreSQL container
50-
let postgres = Postgres::default().start().await?;
26+
#[tokio::test]
27+
async fn test_auth() -> anyhow::Result<()> {
28+
// Start PostgreSQL (requires version 12+)
29+
let postgres = Postgres::default().with_tag("15-alpine").start().await?;
5130
let pg_port = postgres.get_host_port_ipv4(5432).await?;
5231

53-
// 2. Build connection strings
54-
// - Auth container connects via docker internal host
55-
// - Schema init connects via localhost (from host machine)
32+
// Connection strings
5633
let auth_db_url = format!(
5734
"postgres://supabase_auth_admin:password@{}:{}/postgres",
5835
DOCKER_INTERNAL_HOST, pg_port
@@ -62,62 +39,70 @@ async fn main() -> anyhow::Result<()> {
6239
LOCAL_HOST, pg_port
6340
);
6441

65-
// 3. Initialize database schema and start Auth
42+
// Start Auth container
6643
let auth = Auth::default()
6744
.with_db_url(&auth_db_url)
68-
.with_anonymous_users(true)
6945
.init_db_schema(&local_db_url, "password")
7046
.await?
7147
.start()
7248
.await?;
7349

7450
let auth_port = auth.get_host_port_ipv4(AUTH_PORT).await?;
75-
println!("Auth API available at http://localhost:{}", auth_port);
7651

77-
// 4. Make requests to the Auth API
78-
let health = reqwest::get(format!("http://localhost:{}/health", auth_port))
79-
.await?;
80-
assert_eq!(health.status(), 200);
52+
// Verify health
53+
let resp = reqwest::get(format!("http://localhost:{}/health", auth_port)).await?;
54+
assert_eq!(resp.status(), 200);
8155

8256
Ok(())
8357
}
8458
```
8559

86-
### Configuration Options
60+
## Auth Configuration
8761

8862
```rust
89-
use supabase_testcontainers_modules::Auth;
90-
91-
let auth = Auth::default()
92-
.with_db_url("postgres://...") // PostgreSQL connection
93-
.with_jwt_secret("32-char-secret...") // JWT signing secret
63+
Auth::default()
64+
.with_db_url("postgres://...") // PostgreSQL connection (required)
65+
.with_jwt_secret("32-char-minimum...") // JWT signing secret
9466
.with_jwt_expiry(3600) // Token expiry in seconds
9567
.with_site_url("http://localhost:3000") // Frontend URL
96-
.with_signup_disabled(false) // Allow signups
68+
.with_signup_disabled(false) // Allow user signups
9769
.with_anonymous_users(true) // Enable anonymous auth
98-
.with_mailer_autoconfirm(true) // Auto-confirm emails (testing)
99-
.with_sms_autoconfirm(true) // Auto-confirm SMS (testing)
70+
.with_mailer_autoconfirm(true) // Skip email verification
71+
.with_sms_autoconfirm(true) // Skip SMS verification
10072
.with_log_level("debug") // Log verbosity
101-
.with_tag("v2.183.0") // Custom image version
102-
.with_env("CUSTOM_VAR", "value"); // Custom env var
73+
.with_tag("v2.183.0") // Image version
74+
.with_env("KEY", "value") // Custom environment variable
10375
```
10476

105-
## Current Status
106-
107-
The following Supabase services are implemented or planned:
108-
109-
- [ ] Analytics
110-
- [x] Auth (fully implemented)
111-
- [ ] Edge Functions
112-
- [ ] GraphQL (pg_graphql)
113-
- [x] PostgREST (basic implementation)
114-
- [ ] Realtime
115-
- [x] Storage (basic implementation)
116-
117-
## Contributing
77+
## Features
11878

119-
Contributions are welcome! Please feel free to submit a Pull Request.
79+
| Feature | Description |
80+
|---------|-------------|
81+
| `auth` | Supabase Auth (GoTrue) container |
82+
| `postgrest` | PostgREST container |
83+
| `storage` | Supabase Storage container |
84+
| `realtime` | Realtime container |
85+
| `functions` | Edge Functions container |
86+
| `graphql` | pg_graphql container |
87+
| `analytics` | Analytics container |
88+
89+
## Requirements
90+
91+
- Docker
92+
- PostgreSQL 12+ (for Auth migrations)
93+
94+
## Implementation Status
95+
96+
| Service | Status |
97+
|---------|--------|
98+
| Auth | Complete |
99+
| PostgREST | Basic |
100+
| Storage | Basic |
101+
| Realtime | Planned |
102+
| Functions | Planned |
103+
| GraphQL | Planned |
104+
| Analytics | Planned |
120105

121106
## License
122107

123-
This project is licensed under the MIT License.
108+
MIT

0 commit comments

Comments
 (0)