diff --git a/.roo/commands/push.md b/.roo/commands/push.md
index f01dca2..b9f1e17 100644
--- a/.roo/commands/push.md
+++ b/.roo/commands/push.md
@@ -2,4 +2,6 @@
description: "Brief description of what this command does"
---
-Run build_and_push.sh, and supply a good git commit message.
\ No newline at end of file
+Run build_and_push.sh, and supply a good git commit message. For example:
+
+./build_and_push.sh "Fixed the bug with nip05 implementation"
\ No newline at end of file
diff --git a/.rooignore b/.rooignore
new file mode 100644
index 0000000..4a46470
--- /dev/null
+++ b/.rooignore
@@ -0,0 +1 @@
+src/embedded_web_content.c
\ No newline at end of file
diff --git a/Makefile b/Makefile
index ab05d92..41480f2 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ LIBS = -lsqlite3 -lwebsockets -lz -ldl -lpthread -lm -L/usr/local/lib -lsecp256k
BUILD_DIR = build
# Source files
-MAIN_SRC = src/main.c src/config.c src/request_validator.c src/nip009.c src/nip011.c src/nip013.c src/nip040.c src/nip042.c src/websockets.c src/subscriptions.c
+MAIN_SRC = src/main.c src/config.c src/request_validator.c src/nip009.c src/nip011.c src/nip013.c src/nip040.c src/nip042.c src/websockets.c src/subscriptions.c src/api.c src/embedded_web_content.c
NOSTR_CORE_LIB = nostr_core_lib/libnostr_core_x64.a
# Architecture detection
diff --git a/README.md b/README.md
index 359c40f..b73af0a 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,18 @@ Do NOT modify the formatting, add emojis, or change the text. Keep the simple fo
- [x] NIP-50: Keywords filter
- [x] NIP-70: Protected Events
+## 🌐 Web Admin Interface
+
+C-Relay includes a **built-in web-based administration interface** accessible at `http://localhost:8888/api/`. The interface provides:
+
+- **Real-time Configuration Management**: View and edit all relay settings through a web UI
+- **Database Statistics Dashboard**: Monitor event counts, storage usage, and performance metrics
+- **Auth Rules Management**: Configure whitelist/blacklist rules for pubkeys
+- **NIP-42 Authentication**: Secure access using your Nostr identity
+- **Event-Based Updates**: All changes are applied as cryptographically signed Nostr events
+
+The web interface serves embedded static files with no external dependencies and includes proper CORS headers for browser compatibility.
+
## 🔧 Administrator API
C-Relay uses an innovative **event-based administration system** where all configuration and management commands are sent as signed Nostr events using the admin private key generated during first startup. All admin commands use **NIP-44 encrypted command arrays** for security and compatibility.
@@ -87,6 +99,7 @@ All commands are sent as NIP-44 encrypted JSON arrays in the event content. The
| **System Commands** |
| `system_clear_auth` | `["system_command", "clear_all_auth_rules"]` | Clear all auth rules |
| `system_status` | `["system_command", "system_status"]` | Get system status |
+| `stats_query` | `["stats_query"]` | Get comprehensive database statistics |
### Available Configuration Keys
@@ -229,3 +242,18 @@ All admin commands return **signed EVENT responses** via WebSocket following sta
"sig": "response_event_signature"
}]
```
+
+**Database Statistics Query Response:**
+```json
+["EVENT", "temp_sub_id", {
+ "id": "response_event_id",
+ "pubkey": "relay_public_key",
+ "created_at": 1234567890,
+ "kind": 23457,
+ "content": "nip44 encrypted:{\"query_type\": \"stats_query\", \"timestamp\": 1234567890, \"database_size_bytes\": 1048576, \"total_events\": 15432, \"database_created_at\": 1234567800, \"latest_event_at\": 1234567890, \"event_kinds\": [{\"kind\": 1, \"count\": 12000, \"percentage\": 77.8}, {\"kind\": 0, \"count\": 2500, \"percentage\": 16.2}], \"time_stats\": {\"total\": 15432, \"last_24h\": 234, \"last_7d\": 1456, \"last_30d\": 5432}, \"top_pubkeys\": [{\"pubkey\": \"abc123...\", \"event_count\": 1234, \"percentage\": 8.0}, {\"pubkey\": \"def456...\", \"event_count\": 987, \"percentage\": 6.4}]}",
+ "tags": [
+ ["p", "admin_public_key"]
+ ],
+ "sig": "response_event_signature"
+}]
+```
diff --git a/api/index copy.html b/api/index copy.html
new file mode 100644
index 0000000..e5d251d
--- /dev/null
+++ b/api/index copy.html
@@ -0,0 +1,4095 @@
+
+
+
+
+
+
+ C-Relay Admin API
+
+
+
+
+
C-RELAY ADMIN API
+
+
+
+
+
+
+
+
+
+
Name:Loading...
+
Public Key:
+
Loading...
+
+
About:Loading...
+
+
+
+
+
+
+
+
NOSTR AUTHENTICATION
+
Please login with your Nostr identity to access the admin interface.
+
+
+
+
+
+
+
+
RELAY CONNECTION
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
NOT CONNECTED
+
+
+
+
Relay Information (NIP-11)
+
+
+
+
Property
+
Value
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
RELAY CONFIGURATION
+
+
+
+
+
+
+
Parameter
+
Value
+
Actions
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Edit Configuration
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
AUTH RULES MANAGEMENT
+
+
+
+
+
+
+
+
Rule Type
+
Pattern Type
+
Pattern Value
+
Action
+
Status
+
Actions
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ⚠️ WARNING: Adding whitelist rules changes relay behavior to whitelist-only
+ mode.
+ Only whitelisted users will be able to interact with the relay.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
DATABASE STATISTICS
+
NOT LOADED
+
+
Real-time database statistics and metrics. Login required for admin access.