- Notifications
You must be signed in to change notification settings - Fork12
Create Apollo App is a command-line tool designed to generate fully-configured starter Apollo GraphQL projects with essential dependencies for developing web, server and mobile applications and zero build configuration.
License
sysgears/create-apollo-app
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Create Apollo App is a command-line tool that generates a fully configured starter Apollo (GraphQL) project with onlyessential dependencies. With Create Apollo App, you can start developing a client, server, or mobile app, or auniversal application in no time.
The projects generated with Create Apollo App are built of familiar technologies from the JavaScript ecosystem:TypeScript, Webpack, React, Express, and React Native. Depending on the type of the project you want to develop, thementioned technologies are used in different combinations to provide particular setups for server, client, or mobiledevelopment.
Create Apollo App relieves you from the pain of installing and configuring an Apollo project while making it easy tochange project configurations if necessary.
Install the following dependencies:
- Node.js 6.x or higher (Node.js 8.x is recommended)
- NPM or Yarn to manage JavaScript packages and run scripts
Besides the dependencies for Node.js, you may also need to install and set up additional tools for mobile development:
- iOS Simulator or Android emulation software
- Xcode (optional; an IDE for iOS development)
- Android Studio (optional; an IDE for Android development)
InstallingExpo Client is also optional. If you set up iOS Simulator or a similar tool,Create Apollo App will automatically download Expo Client if it's not installed.
Start a new project with Create Apollo App using the following command (the default NPM utility is used):
npx create-apollo-app new-apollo-app
If you’re using Yarn, run:
yarn create apollo-app my-app
yarn createwill automatically prefixapollo-appwithcreate-. For more information, you can consult thisblogpost on Yarn.
From this point onward, we'll use Yarn in our examples for running the project.
During installation, the terminal will prompt the following six options:
❯ @server-web: TypeScript, Apollo (GraphQL), Express server, React for web @server-mobile: TypeScript, Apollo (GraphQL), Express server, React Native for mobile @universal: TypeScript, Apollo (GraphQL), Express server, React for web, React Native for mobile @server: TypeScript, Apollo (GraphQL), Express server @web: TypeScript, Apollo (GraphQL), React web app @mobile: TypeScript, Apollo (GraphQL), React Native for mobileYou can select the necessary project template using the arrow keys on your keyboard. Alternatively, you can start typingthe name of the template to filter the list.
You can also specify the name of the template by attaching the@name_of_the_template after the project name, forexample:
yarn create apollo-app my-app@web
If you run the command above, Create Apollo App will create amy-app/ project directory with the@web template meaningthe client-side Apollo app. Similarly, add@server-web,@universal, or other template name instead of@web tochoose a particular template.
Consultthe Apollo Project Templates section to know what templates are currentlyavailable.
Select the first (default) option@server-web from the list and press Enter. Create Apollo App will generate aclient-server application.
Note that it may take a while (usually up to a minute) for all dependencies to be installed and for the project to beconfigured. The terminal will confirm when the project is ready.
Once the installation is complete, run:
cd my-appyarn startA development build will be generated. You can start changing the source code in the project files located in thepackages/server/src/ andpackages/web/src/ directories.
NOTE: If you want to add CSS, SCSS, Sass, or Less to the frontend React application, you need to add the PostCSSconfiguration filepostcss.config.js under the{app-root}/src for the@web template or the{app-root}/packages/web/src folder for the@server-web and@universal templates.
The PostCSS configuration file can be empty, like this:
module.exports={};
The client-side application will be automatically opened in your default browser athttp://localhost:3000.The server-side GraphQL application runs onhttp://localhost:8080.
If you installed a template for mobile development, the React Native app will be opened athttp://localhost:3020for iOS and athttp://localhost:3010 for Android.
If you want to build a production version of the app (i.e., the code will be minified), run:
yarn build
The production-ready code will be saved topackages/server/build/ andpackages/web/build/ directories forserver-side and client-side code respectively.
Create Apollo App provides you with the default configurations for different kinds of projects. For example, if you needto build only a client-side application, you can select a respective template –@web – during installation.
Overall, you can choose one of the six templates:
@webfor a client-side application.@serverfor a server-side application.@mobilefor a mobile application.@server-web– (default) a complete solution for building a client-server app.@server-mobile– a complete solution for building a server-side app and mobile front end.@universal– the most comprehensive solution for building an app for the client, server, and mobile.
We'll review the structure of the@universal project, meaning it will have theclient/,server/, andmobile/packages under thepackages/ directory. The@server-web template that you installed comes without the mobile package.
Here's an overview of the@universal project structure:
my-apollo-app├── node_modules/├── packages/ ├── mobile ├── node_modules/ ├── src/ ├── App.tsx ├── AwakeInDevApp.js └── index.ts ├── typings/ ├── app.json ├── package.json ├── tsconfig.json └── tslint.json ├── server/ ├── node_modules/ ├── src/ ├── index.ts ├── resolvers.ts ├── schema.graphql ├── schema.ts └── server.ts ├── typings/ ├── package.json ├── tsconfig.json └── tslint.json └── web/ ├── src/ ├── App.tsx └── index.tsx ├── typings/ ├── package.json ├── tsconfig.json └── tslint.json├── .gitignore├── package.json├── tsconfig.json├── tslint.json└── yarn.lockYou'll work with the files located inpackages/mobile/src/,packages/server/src, andpackages/web/src/ when workingon your Apollo project. In those directories, you can view the default project files, which you may freely change ordelete.
Copyright © 2018SysGears Limited. This source code is licensed under theMIT license.
About
Create Apollo App is a command-line tool designed to generate fully-configured starter Apollo GraphQL projects with essential dependencies for developing web, server and mobile applications and zero build configuration.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors9
Uh oh!
There was an error while loading.Please reload this page.