Skip to content

Project Structure

Gunes Korkmaz edited this page Jul 10, 2024 · 2 revisions

Brief project description goes here.

/: Main

  • generate.go: Script to generate necessary code.
  • go.mod and go.sum: Define the module's dependencies.
  • main.go: The entry point for the service.
  • readme.md: Documentation for the project.
  • server.go: Handles server setup and configuration.
  • tools.go: Contains code for tools used in the project.
  • gqlgen.yml: Configuration file for gqlgen, a Go library for building GraphQL servers.
  • .gitignore: Specifies intentionally untracked files to ignore when using Git.

/auth: Contains authentication related code.

  • user_context.go: Handles user context.
  • jwt.go: Handles JWT authentication.
  • auth_middleware.go: Middleware for authentication.

/clients: Contains client related code.

  • colly_client.go: Handles interactions with the Colly web scraping framework.

/config: Contains configuration files for the service.

  • configuration.go: Handles loading and parsing of configuration.
  • config.yaml: YAML configuration file.
  • provider_enum.go: Enumerations for database provider configurations.

/database: Contains database related code.

  • /configure: Database configuration related code.
  • /enums: Enumerations used in the database.
  • /models: Database models.
  • /relations: Database relations.
  • /types: Database JSON Object Types.
  • connection.go: Handles database connection.
  • embeded_postgre.go: Handles embedded PostgreSQL database.
  • mock.go: Mock data for testing.
  • migrate.go: Handles database migrations.

/directives: Contains graphql directive related code.

  • domain_url_check.go: Directive for domain URL check. (Checks the domain from database, domain must be unique)
  • organization_permission.go: Directive for organization permission.
  • auth_directive.go: Directive for authentication.
  • platform_permission.go: Directive for platform permission.
  • assign.go: Directive middleware for assignment to graphql.

/graph: Contains GraphQL related code.

  • /model: GraphQL models.
    • /connections: Connection related models.
      • relay.go: Relay connection model.
    • /inputs: Input related models.
    • models_gen.go: Generated models.
  • /resolvers: GraphQL resolvers.
  • /schemas: GraphQL schemas.
    • sgorm-gqlgen-relay-generated.gql: Generated schema for relay.
    • schema.gql: Base schema with some directives and enums.
  • generated.go: Generated GraphQL code.
  • /loaders: Contains data loader related code.
    • user_loader.go: User data loader.
    • loaders.go: Base data loader.

/services: Contains business logic related code.

  • /domain: Domain related services.
  • /link: Link related services.
  • /organization: Organization related services.
  • /platform: Platform related services.
  • /user: User related services.
  • /utils: Utility services.
    • lru_cache.go: Provides a Least Recently Used (LRU) cache.
    • hash_service.go: Provides hashing services.
    • lru_expireable_cache.go: Provides an LRU cache with expiration.
    • url_validator.go: Provides URL validation services.
  • service_container.go: Contains the service container that manages all services.