How attic-labs/graphql works
Project type and purpose
• This is a Go library implementing the core GraphQL specification (lexer, parser, AST, schema, validation, execution, printer) for use in Go applications.
• It is distributed as an open-source tool (a Go package) rather than a standalone server or full-stack app.
File structure
• Top-level files:
• graphql.go, executor.go, validator.go, schema.go, directives.go, scalars.go, introspection.go, definition.go – the core API entry points and orchestration.
• gqlerrors/ – error models and formatting.
• language/ – subpackages for the language pipeline:
• lexer/ – tokenizes GraphQL source
• parser/ – builds AST from tokens
• ast/ – AST node definitions
• printer/ – serializes AST back to GraphQL syntax
• typeInfo/ – collects type metadata
• visitor/ – generic AST traversal
• kinds/, location/, source/ – supporting utilities
• testutil/ – test harnesses for validation, introspection, etc.
• examples/ – sample standalone programs demonstrating usage in different contexts (HTTP handler, context, todo, star-wars).
• tests scattered alongside code (e.g. *_test.go).
README for additional insights
• Confirms this is a work-in-progress port of graphql-js.
• Lists supported features: lexer, parser, schema parser, printer, executor, validator, visitor.
• Mentions recommended middleware (graphql-go-handler) for HTTP integration.
Elements
• Green for core pipeline modules
• Blue for supporting utilities (visitor, typeInfo)
• Yellow for error handling
• Grey for examples/tests
• Annotation of key public functions (graphql.Do, graphql.NewSchema).