How safwanhasan120/synapse works
Synapse is a team knowledge-memory product: users authenticate, organize projects, propose context units, review them into accepted knowledge, then retrieve relevant accepted units through semantic search. The API owns those domain operations and persists them in PostgreSQL; accepted units are embedded through OpenAI. The repository also includes a web interface and an MCP server, but the available evidence does not establish their runtime connections to the API, so those links are left unverified.
Main entry points: app.ts HTTP application · index.ts Database access · embeddings.ts Embeddings and semantic search · auth.ts JWT authorization
Components 18
API and identity
- HTTP application
apps/api/src/app.ts - GitHub authentication
apps/api/src/routes/auth.ts - JWT authorization
apps/api/src/middleware/auth.ts - Teams and projects
apps/api/src/routes/teams.ts - Runtime configuration
apps/api/src/config.ts - HTTP logging
apps/api/src/middleware/logger.ts - Error handling
apps/api/src/middleware/error.ts - Shared types
packages/shared/src/index.ts
Knowledge lifecycle
- Context unit workflow
apps/api/src/routes/context-units.ts - Search endpoint
apps/api/src/routes/search.ts - Embeddings and semantic search
apps/api/src/services/embeddings.ts
Persistence and search
- Database access
apps/api/src/db/index.ts - PostgreSQL
Product clients
- Web interface
apps/web/src/app - Web API client
apps/web/src/lib/api.ts - MCP server
apps/mcp-server/src/index.ts
Other components
- Team user
- OpenAI embeddings
Connections 30
- Team user → Web interface: uses
apps/web/src/app/page.tsx - Team user → MCP server: uses
- Web interface → Web API client: calls
- Web API client → HTTP application: requests
- Team user → HTTP application: authenticates
- HTTP application → GitHub authentication: routes to
apps/api/src/app.ts - HTTP application → Teams and projects: routes to
apps/api/src/app.ts - HTTP application → Search endpoint: routes to
apps/api/src/app.ts - HTTP application → Context unit workflow: routes to
apps/api/src/app.ts - HTTP application → HTTP logging: logs requests
apps/api/src/app.ts - HTTP application → Error handling: handles errors
apps/api/src/app.ts - GitHub authentication → Team user: redirects browser
apps/api/src/routes/auth.ts - GitHub authentication → Database access: reads and writes
apps/api/src/routes/auth.ts - GitHub authentication → JWT authorization: protects profile
apps/api/src/routes/auth.ts - Teams and projects → JWT authorization: requires token
apps/api/src/routes/teams.ts - Context unit workflow → JWT authorization: requires token
apps/api/src/routes/context-units.ts - Search endpoint → JWT authorization: requires token
apps/api/src/routes/search.ts - Teams and projects → Database access: reads and writes
apps/api/src/routes/teams.ts - Context unit workflow → Database access: reads and writes
apps/api/src/routes/context-units.ts - Search endpoint → Database access: checks access
apps/api/src/routes/search.ts - Context unit workflow → Embeddings and semantic search: embeds approved unit
apps/api/src/routes/context-units.ts - Search endpoint → Embeddings and semantic search: searches semantically
apps/api/src/routes/search.ts - Embeddings and semantic search → OpenAI embeddings: requests vectors
apps/api/src/services/embeddings.ts - Embeddings and semantic search → Database access: stores and searches vectors
apps/api/src/services/embeddings.ts - Database access → PostgreSQL: queries
apps/api/src/db/index.ts - Database access → Runtime configuration: reads connection settings
apps/api/src/db/index.ts - JWT authorization → Runtime configuration: reads JWT secret
apps/api/src/middleware/auth.ts - HTTP logging → Runtime configuration: reads log settings
apps/api/src/middleware/logger.ts - Error handling → HTTP logging: logs failures
apps/api/src/middleware/error.ts - Embeddings and semantic search → HTTP logging: logs embedding status
apps/api/src/services/embeddings.ts