Skip to content
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
27960dd
feat: add @atproto/lexicon-resolver package
caidanw Nov 25, 2025
475008f
feat: add @atproto/syntax package
caidanw Nov 25, 2025
be7409b
feat: add @atproto/lexicon package
caidanw Nov 25, 2025
37dc82b
feat(util): add LexiconSchemaRecord type and type guard for lexicon N…
caidanw Nov 26, 2025
a377825
feat(api): validate lexicon schema record and enforce DID authority i…
caidanw Nov 26, 2025
6ff2ae8
feat: add zod package
caidanw Nov 26, 2025
7a07c86
refactor(util): redefine LexiconSchemaRecord to require 'id' field fo…
caidanw Nov 27, 2025
8982863
feat(api): parse and validate lexicon records using parseLexiconDoc a…
caidanw Nov 27, 2025
dc5c7dd
refactor(db): separate valid and invalid lexicons into distinct tables
caidanw Dec 1, 2025
ee77d08
feat(api): store valid and invalid lexicons in separate tables
caidanw Dec 1, 2025
28a66b0
refactor(db): squash migrations into single init migration
caidanw Dec 2, 2025
de572dd
chore(dev): add compose.override.yaml for local development with cust…
caidanw Dec 2, 2025
45910bd
fix(api): prevent duplicate valid lexicon inserts with onConflictDoNo…
caidanw Dec 2, 2025
b6b6509
fix(api): improve ZodError detection to catch validation errors properly
caidanw Dec 2, 2025
74e9a2a
refactor(api): extract isZodError helper for clearer validation error…
caidanw Dec 2, 2025
ecc3500
refactor(api): inline lexiconDoc declaration in ingest route for clea…
caidanw Dec 2, 2025
f3bef21
docs(api): fix typo in DNS validation comment in ingest route
caidanw Dec 2, 2025
69980d5
refactor(api): simplify DNS validation check in ingest route
caidanw Dec 2, 2025
84a4023
refactor(api): remove unused LexiconDoc import from ingest route
caidanw Dec 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions compose.override.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be in .gitignore?

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Development overrides for docker-compose
# This file is automatically loaded by docker-compose and overrides compose.yaml
# For production, use: docker-compose -f compose.yaml up
#
# In development, run lexhub locally with: npm run dev
# Only nexus and postgres run in Docker for development

services:
lexhub:
# Disable lexhub service in development
# Run it locally instead with: npm run dev
scale: 0

nexus:
restart: no
network_mode: host
ports: []
volumes: []
environment:
# Reduced parallelism for lighter resource usage
- NEXUS_FIREHOSE_PARALLELISM=5
- NEXUS_RESYNC_PARALLELISM=2
- NEXUS_OUTBOX_PARALLELISM=2
# Debug logging for development
- NEXUS_LOG_LEVEL=debug
- NEXUS_WEBHOOK_URL=http://host.docker.internal:10000/api/ingest

postgres:
restart: no
command:
- "postgres"
- "-c"
- "shared_preload_libraries=pg_stat_statements"
- "-c"
- "pg_stat_statements.track=all"
# Reduced resources for development
- "-c"
- "max_connections=100"
- "-c"
- "shared_buffers=128MB"
- "-c"
- "effective_cache_size=512MB"
- "-c"
- "work_mem=8MB"
- "-c"
- "maintenance_work_mem=64MB"
# SQL query logging for debugging
- "-c"
- "log_statement=all"
- "-c"
- "log_duration=on"
49 changes: 27 additions & 22 deletions drizzle/0000_init.sql
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
CREATE TABLE "lexicons" (
"id" varchar(317) NOT NULL,
-- Create valid_lexicons table
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably don't need this comment 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with a couple others

CREATE TABLE "valid_lexicons" (
"nsid" varchar(317) NOT NULL,
"cid" varchar(100) NOT NULL,
"repo_did" varchar(256) NOT NULL,
"repo_rev" varchar(256) NOT NULL,
"data" jsonb NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "lexicons_id_cid_pk" PRIMARY KEY("id","cid")
"ingested_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "valid_lexicons_nsid_cid_repo_did_pk" PRIMARY KEY("nsid","cid","repo_did")
);
--> statement-breakpoint
CREATE INDEX "lexicons_id_idx" ON "lexicons" USING btree ("id");--> statement-breakpoint
CREATE INDEX "lexicons_created_at_idx" ON "lexicons" USING btree ("created_at");--> statement-breakpoint
CREATE INDEX "lexicons_data_gin_idx" ON "lexicons" USING gin ("data");--> statement-breakpoint


CREATE OR REPLACE FUNCTION update_updated_at_column()
RETURNS TRIGGER AS $$
BEGIN
NEW.updated_at = NOW();
RETURN NEW;
END;
$$ language 'plpgsql';

CREATE TRIGGER update_lexicons_updated_at
BEFORE UPDATE ON "lexicons"
FOR EACH ROW
EXECUTE FUNCTION update_updated_at_column();
-- Create invalid_lexicons table
CREATE TABLE "invalid_lexicons" (
"nsid" varchar(317) NOT NULL,
"cid" varchar(100) NOT NULL,
"repo_did" varchar(256) NOT NULL,
"repo_rev" varchar(256) NOT NULL,
"raw_data" jsonb NOT NULL,
"validation_errors" jsonb NOT NULL,
"ingested_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "invalid_lexicons_nsid_cid_repo_did_pk" PRIMARY KEY("nsid","cid","repo_did")
);
--> statement-breakpoint
-- Create indexes for valid_lexicons
CREATE INDEX "valid_lexicons_nsid_idx" ON "valid_lexicons" USING btree ("nsid");--> statement-breakpoint
CREATE INDEX "valid_lexicons_repo_did_idx" ON "valid_lexicons" USING btree ("repo_did");--> statement-breakpoint
CREATE INDEX "valid_lexicons_data_gin_idx" ON "valid_lexicons" USING gin ("data");--> statement-breakpoint
-- Create indexes for invalid_lexicons
CREATE INDEX "invalid_lexicons_nsid_idx" ON "invalid_lexicons" USING btree ("nsid");--> statement-breakpoint
CREATE INDEX "invalid_lexicons_repo_did_idx" ON "invalid_lexicons" USING btree ("repo_did");--> statement-breakpoint
CREATE INDEX "invalid_lexicons_raw_data_gin_idx" ON "invalid_lexicons" USING gin ("raw_data");
2 changes: 1 addition & 1 deletion drizzle/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"idx": 0,
"version": "7",
"when": 1763597119878,
"when": 1733093280000,
"tag": "0000_init",
"breakpoints": true
}
Expand Down
Loading