• Stars
    star
    2,480
  • Rank 18,539 (Top 0.4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Create React apps using Kotlin with no build configuration

Build Status JetBrains team project

Japanese Korean

Create React Kotlin App

Create React apps in Kotlin with no build configuration.

Please note that this is an early preview version.

Quick Overview

Make sure you have JDK 8 or newer version installed before proceeding.

Create a new project:

npx create-react-kotlin-app my-app

(npx comes with npm 5.2+ and higher. See Installation for older npm versions.)

Run the project:

cd my-app/
npm start

Then open http://localhost:3000/ to see your app.
When you’re ready to deploy to production, create a minified bundle with npm run build.

Create React Kotlin App will configure Kotlin, webpack, and IntelliJ IDEA so that you can focus on the code instead.

Just create a project, and you’re good to go.

Getting Started

Installation

Install it once globally:

npm install -g create-react-kotlin-app

You can skip this step if you have create-react-app already installed or you're using npx.

You’ll need to have Node >= 6 on your machine. You can use nvm to easily switch between Node versions for different projects.

This tool doesn’t assume a Node backend. The Node installation is only required for Create React Kotlin App itself.

Using React with Kotlin

To develop applications in Kotlin that use React you need to use a Kotlin wrapper for React. You can find a documentation for it and examples in the module's repository.

Adding Kotlin/JS packages

No configuration is required to add packages written in Kotlin to a project based on Create React Kotlin App, we take care of it for you. For example, you can simply run npm install @jetbrains/kotlin-react-router-dom to install the wrapper for React Router DOM.

Creating an App

To create a new app, run:

create-react-kotlin-app my-app
cd my-app

Or if you have create-react-app installed, you can run:

create-react-app my-app --scripts-version react-scripts-kotlin
cd my-app

It will create a folder called my-app inside the current folder.
The project will be preconfigured for working with it in IntelliJ IDEA. If you don't want to create the .idea folder that is required for IntelliJ IDEA, add --no-idea option.
The initial project structure will be created and dependencies will be installed:

my-app/
  README.md
  node_modules/
  package.json
  .gitignore
  public/
    favicon.ico
    index.html
    manifest.json
  src/
    app/
      App.css
      App.kt
    index/
      index.css
      index.kt
    logo/
      kotlin.svg
      Logo.css
      Logo.kt
      react.svg
    ticker/
      Ticker.kt

It's a simple app that shows the time that passed since the app was opened.
Once the installation is done, you can run some commands inside the project folder:

npm start or yarn start

Runs the app in development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload automatically when you make edits.
You will see build errors and lint warnings in the console.

If you are getting a Kotlin.defineModule is not a function error, try deleting the npm cache:

rm -rf node_modules/.cache

npm run build or yarn build

Builds the app for production to the build folder.
It ensures that React is bundled in production mode and the build is optimized for best performance.

The build is minified and the filenames include hashes for cache management. Your app is ready to be deployed.

Debugging the App

You can debug the running app right in IntelliJ IDEA Ultimate using its built-in JavaScript debugger. The IDE will run a new instance of Chrome and attach a debugger to it.

Start your app by running npm start. Put the breakpoints in your Kotlin code. Then select Debug in Chrome from the list of run/debug configurations on the top-right and click the green debug icon or press ^D on macOS or F9 on Windows and Linux to start debugging.

Currently, debugging is supported only in IntelliJ IDEA Ultimate 2017.3.

You can also debug your application using the developer tools in your browser.

Philosophy

  • One Dependency: There is just one build dependency. It uses webpack and other amazing projects, but provides a cohesive curated experience on top of them.

  • No Configuration Required: You don't need to configure anything. Reasonably good configuration of both development and production builds is handled for you so you can focus on writing code.

  • No Lock-In: You can “eject” to a custom setup at any time. Run a single command, and all the configuration and build dependencies will be moved directly into your project, so you can pick up right where you left off.

What’s Inside?

The generated project uses the following npm modules:

Why Use This?

With create-react-kotlin-app you can quickly bootstrap a new application using Kotlin and React. Your environment will have everything you need to build a new Kotlin app:

  • Kotlin and React syntax support.
  • A dev server that automatically compiles your Kotlin code to JavaScript.
  • A build script to bundle JavaScript, CSS, and images for production, with sourcemaps.

Limitations

  • Unit testing is currently not supported in this project. We're now working on the Jest Kotlin wrapper. Unit-testing React is tracked in KT-49610. Stay tuned!

Converting to a Custom Setup

You can “eject” from the tool and use it as a boilerplate generator.

Running npm run eject copies all configuration files and transitive dependencies (webpack, Kotlin Compiler, etc) right into your project so you have full control over them. Commands like npm start and npm run build will still work, but they will point to the copied scripts so you can tweak them. At this point, you’re on your own.

Note: this is a one-way operation. Once you eject, you can’t go back!

Contributing and reporting issues

Please report issues on YouTrack, GitHub issues are disabled for this project.

Contributions to this project are welcome! Please see the open issues or chat with us on the #react channel in our Slack.

Acknowledgements

This project is based on Facebook's Create React App. Many thanks to its authors for their work and inspiration.

More Repositories

1

kotlin

The Kotlin Programming Language.
Kotlin
48,745
star
2

intellij-community

IntelliJ IDEA Community Edition & IntelliJ Platform
Java
17,135
star
3

compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
Kotlin
16,179
star
4

JetBrainsMono

JetBrains Mono – the free and open-source typeface for developers
Shell
10,765
star
5

Exposed

Kotlin SQL Framework
Kotlin
8,296
star
6

ideavim

IdeaVim – A Vim engine for JetBrains IDEs
Kotlin
7,980
star
7

kotlin-native

Kotlin/Native infrastructure
Kotlin
7,026
star
8

ring-ui

A collection of JetBrains Web UI components
TypeScript
3,595
star
9

intellij-platform-plugin-template

Template repository for creating plugins for IntelliJ Platform
Kotlin
3,048
star
10

kotlinconf-app

KotlinConf Schedule Application
Kotlin
2,967
star
11

skija

Java bindings for Skia
Java
2,628
star
12

projector-docker

Run JetBrains IDEs remotely with Docker
Shell
2,235
star
13

intellij-plugins

Open-source plugins included in the distribution of IntelliJ IDEA Ultimate and other IDEs based on the IntelliJ Platform
Java
2,002
star
14

svg-sprite-loader

Webpack loader for creating SVG sprites.
JavaScript
1,998
star
15

skiko

Kotlin Multiplatform bindings to Skia
C++
1,825
star
16

compose-multiplatform-ios-android-template

Compose Multiplatform iOS+Android Application project template
Kotlin
1,600
star
17

lets-plot

Multiplatform plotting library based on the Grammar of Graphics
Kotlin
1,559
star
18

MPS

JetBrains Meta programming System
JetBrains MPS
1,527
star
19

kotlin-web-site

The Kotlin programming language website
JavaScript
1,474
star
20

intellij-platform-gradle-plugin

Gradle plugin for building plugins for IntelliJ-based IDEs
Kotlin
1,426
star
21

kotlin-wrappers

Kotlin wrappers for popular JavaScript libraries
Kotlin
1,339
star
22

phpstorm-stubs

PHP runtime & extensions header files for PhpStorm
PHP
1,317
star
23

JetBrainsRuntime

Runtime environment based on OpenJDK for running IntelliJ Platform-based products on Windows, macOS, and Linux
Java
1,312
star
24

idea-gitignore

.ignore support plugin for IntelliJ IDEA
Kotlin
1,290
star
25

projector-server

Server-side library for running Swing applications remotely
Kotlin
1,246
star
26

intellij-sdk-docs

IntelliJ SDK Platform Documentation
Markdown
1,212
star
27

resharper-unity

Unity support for both ReSharper and Rider
C#
1,209
star
28

intellij-scala

Scala plugin for IntelliJ IDEA
Scala
1,192
star
29

xodus

Transactional schema-less embedded database used by JetBrains YouTrack and JetBrains Hub.
Java
1,180
star
30

kotless

Kotlin Serverless Framework
Kotlin
1,147
star
31

intellij-sdk-code-samples

Mirror of the IntelliJ SDK Docs Code Samples
Java
1,074
star
32

amper

Amper - a project configuration and build tool with a focus on the user experience and the IDE support
Kotlin
995
star
33

js-graphql-intellij-plugin

GraphQL language support for WebStorm, IntelliJ IDEA and other IDEs based on the IntelliJ Platform.
Java
879
star
34

android

Android Plugin for IntelliJ IDEA. This repository is a subset of https://git.jetbrains.org/?p=idea/android.git cut according to GitHub file size limitations.
Kotlin
863
star
35

projector-installer

Install, configure and run JetBrains IDEs with Projector Server on Linux or in WSL
Python
808
star
36

projector-client

Common and client-related code for running Swing applications remotely
Kotlin
806
star
37

Grammar-Kit

Grammar files support & parser/PSI generation for IntelliJ IDEA
Java
715
star
38

jewel

An implementation of the IntelliJ look and feels in Compose for Desktop
Kotlin
709
star
39

markdown

Markdown parser written in kotlin
Kotlin
691
star
40

Arend

The Arend Proof Assistant
Java
691
star
41

jediterm

Pure Java Terminal Emulator. Works with SSH and PTY.
Java
675
star
42

compose-multiplatform-template

Compose Multiplatform Application project template
Kotlin
623
star
43

lincheck

Framework for testing concurrent data structures
Kotlin
576
star
44

Nitra

Public Nitra repository
Nemerle
549
star
45

intellij-micropython

Plugin for MicroPython devices in PyCharm and IntelliJ
Python
506
star
46

compose-multiplatform-desktop-template

Compose Multiplatform Desktop Application project template
Kotlin
447
star
47

kotlin-playground

Self-contained component to embed in websites for running Kotlin code
JavaScript
440
star
48

lets-plot-kotlin

Grammar of Graphics for Kotlin
Kotlin
434
star
49

java-annotations

Annotations for JVM-based languages.
Kotlin
405
star
50

colorSchemeTool

Python
396
star
51

Qodana

📝 Source repository of Qodana Help
389
star
52

phpstorm-attributes

PhpStorm specific attributes
PHP
388
star
53

godot-support

C#
385
star
54

rd

Reactive Distributed communication framework for .NET, Kotlin, C++. Inspired by Rider IDE.
C#
385
star
55

pty4j

Pty for Java
Java
354
star
56

Unity3dRider

Unity JetBrains Rider integration
348
star
57

resharper-fsharp

F# support in JetBrains Rider
F#
328
star
58

phpstorm-workshop

Code for the PhpStorm workshop
PHP
287
star
59

web-types

JSON standard for documenting web component libraries for IDEs, documentation generators and other tools
TypeScript
280
star
60

awesome-pycharm

A curated list of resources for learning and using PyCharm, a Python IDE from JetBrains
280
star
61

gradle-changelog-plugin

Plugin for parsing and managing the Changelog in a "keep a changelog" style.
Kotlin
266
star
62

youtrack-mobile

A iOS and Android client for YouTrack
TypeScript
265
star
63

meta-runner-power-pack

A set of Meta-runners for TeamCity
PowerShell
256
star
64

inspection-plugin

Gradle plugin to launch IDEA inspections
Kotlin
256
star
65

ideolog

Interactive viewer for '.log' files.
Kotlin
254
star
66

qodana-action

⚙️ Scan your Go, Java, Kotlin, PHP, Python, JavaScript, TypeScript, .NET projects at GitHub with Qodana. This repository contains Qodana for Azure, GitHub, CircleCI and Gradle
JavaScript
248
star
67

jcef

A simple framework for embedding Chromium-based browsers into Java-based applications.
Java
245
star
68

kotlin-compiler-server

Server for executing kotlin code
Kotlin
241
star
69

gradle-idea-ext-plugin

Plugin to store IJ settings in gradle script
Groovy
233
star
70

resharper-rider-samples

Simple interactive exercises to help learn ReSharper and Rider
C#
225
star
71

php-timeline

Notable events of PHP history
222
star
72

la-clojure

Clojure plugin for IntelliJ IDEA
Java
220
star
73

jdk8u_jdk

Java
212
star
74

pest-intellij

The official Pest Plugin for PhpStorm / IntelliJ IDEA
Kotlin
197
star
75

youtrack-workflows

YouTrack Custom Workflow Repository
JavaScript
194
star
76

psiviewer

PSI Viewer for IntelliJ IDEA plugin development
Java
184
star
77

intellij-plugin-verifier

Compatibility verification tool for IntelliJ Platform plugins
Kotlin
178
star
78

resharper-rider-plugin

https://www.jetbrains.com/help/resharper/sdk/
PowerShell
175
star
79

rider-efcore

Entity Framework Core UI plugin for JetBrains Rider
Kotlin
174
star
80

svg-mixer

Node.js toolset for generating & transforming SVG images and sprites in modern way
JavaScript
173
star
81

qodana-cli

🔧 JetBrains Qodana’s official command line tool
Go
171
star
82

phpstorm-docker-images

Pre-configured Docker images used by PhpStorm team
Dockerfile
171
star
83

compose-for-web-demos

Historical repository of early Compose for Web effort.
170
star
84

kotlin-web-demo

Online mini-IDE for Kotlin
Kotlin
167
star
85

intellij-samples

Code that demonstrates various IntelliJ IDEA features
Java
167
star
86

jetbrains_guide

JetBrains Guides where Developer Advocacy and the community share ideas.
CSS
164
star
87

jdk8u_hotspot

C++
159
star
88

educational-plugin

Educational plugin to learn and teach programming languages such as Kotlin, Java, Python, JavaScript, and others right inside of JetBrains IntelliJ Platform based IDEs.
Kotlin
152
star
89

teamcity-messages

Python Unit Test Reporting to TeamCity
Python
139
star
90

lets-plot-skia

Skia frontend for Lets-Plot multiplatform plotting library.
Kotlin
137
star
91

ruby-type-inference

Dynamic definitions and types provider for ruby static analysis
Kotlin
137
star
92

YouTrackSharp

.NET Standard 2.0 Library to access YouTrack API.
C#
134
star
93

clion-remote

134
star
94

resharper-angularjs

ReSharper plugin for AngularJS support
JavaScript
134
star
95

UnrealLink

C++
132
star
96

golandtipsandtricks

This is an ever evolving repository for GoLand Tips&Tricks
Go
132
star
97

python-skeletons

The python-skeltons repo is deprecated: use PEP 484 and Typeshed instead
Python
132
star
98

phpstorm-phpstan-plugin

PHPStan plugin for PhpStorm
Java
131
star
99

clion-wsl

Shell
130
star
100

teamcity-docker-samples

TeamCity docker compose samples
Shell
128
star