# Migrating to Lighthouse

This section contains advice on how you can migrate existing API projects to Lighthouse.

# Schema definition

The most important thing to get you started using Lighthouse will be a schema that is written using GraphQL Schema Definition Language.

If you already have a server with another library up and running, you can use introspection to retrieve this schema and save it to a file.

A simple tool that is also generally useful is graphql-cli (opens new window).

npm install -g graphql-cli
graphql init
graphql get-schema --endpoint=example.com/graphql --output=schema.graphql

Type definitions that previously done through code can mostly be deduced from the schema. Sometimes, additional annotations or a PHP implementation is required. How to define types

# Resolver logic

If you are coming from libraries such as Folkloreatelier/laravel-graphql (opens new window), rebing/laravel-graphql (opens new window) or any other library that is originally based upon webonyx/graphql-php (opens new window), you should be able to reuse much of your existing code.

You can also register your existing types within Lighthouse's type registry, so you won't have to rewrite them in SDL: Use native PHP types.

Resolver functions share the same common signature, so you should be able to reuse any logic you have written for Queries/Mutations.

Lighthouse simplifies many common tasks, such as basic CRUD operations, eager loading relationships, pagination or validation.