An initial and empty silvie project should have these files and folders in order to work properly. For a further explanation please take your time to get familiar with the structure and continue reading below.
Now we are going to discuss each directory, and the reason it is important to for the Silvie. Some directories need you to create an initial file in them which is explained after directory description.
This is where you store your source codes. all of your static assets and code files must be located in this directory.
This directory may contain your static assets. It will be copied to the output(compiled) directory after you build or bundle your application.
This directory will contain an index file which is meant to call the Silvie bootstrap function to start the application. You need to load all schemas, resolvers and data loaders and pass them all to the bootstrap function, to initialize a GraphQL Server with those initial entities.
Your config files will be stored here. There must be some initial config files which you can learn more about in Configuration Section
This directory will contain the controllers.
This directory will contain database migrations which will create database entities from the schema definitions.
This directory will contain database seeders to insert initial data into database tables.
This directory will contain all of GraphQL data loaders.
This directory will contain all of GraphQL resolvers.
This directory will contain all of GraphQL schemas.
Please note that you need to import schemas, resolvers and data loaders in your bootstrap file and pass them to Silvie's bootstrap function.
This directory will contain all of your models. They will be automatically loaded into the application.
These files need to be created initially to run your application.
This file is a configuration file that may be different on various environments. It contains application specific information, database and redis credentials or any other environment variables you may want to inject into your codes.
This file has no actual effect in the application. It is an empty template for the main
.env file, because it is
not a good practice to upload
.env files since it may contain sensitive passwords. You should make a copy of
.env.example on your server and fill in the blanks there.
If you are working with Git, you should exclude some directories. To prevent uploading them along with your codes.
This is the typescript configuration file to resolve modules with an alias name and enable some language features. You can learn more about Typescript configurations in Silvie, in Configuration Section.
To ensure the directory structure has been set up correctly, use
silvie check command. Or if you need some help with
creating the initial files or create missing files and directories, use
silvie fix command.
The following directories do not exist at first, But will be created next to src folder when you somehow run or build the application.
This directory is some sort of temporary directory which contains storage files, tmp upload directory and session files. This is created automatically whenever you run the application in development mode. It will be created in production too, but it will be in their corresponding directories.
This directory will be created after you run the build command. The build command will compile your project files into
Node.js compatible files. Then you can run your application by running the
This directory will be created after you run the bundle command. This command will bundle all of your source files into