diff --git a/Data/HighJson/TH.hs b/Data/HighJson/TH.hs
new file mode 100644
--- /dev/null
+++ b/Data/HighJson/TH.hs
@@ -0,0 +1,28 @@
+{-# LANGUAGE TemplateHaskell #-}
+module Data.HighJson.TH
+    ( deriveJsonSwagger
+    , jsonSerializer, jsonEncoder, jsonParser
+    , makeDeclareNamedSchema
+    , ToSchema(..)
+    , ToJSON(..), FromJSON(..)
+    )
+where
+
+import Data.Aeson
+import Data.Swagger
+import Language.Haskell.TH
+
+import Data.HighJson (jsonSerializer, jsonEncoder, jsonParser)
+import Data.HighJson.Swagger (makeDeclareNamedSchema)
+
+deriveJsonSwagger :: Name -> Name -> Q [Dec]
+deriveJsonSwagger typ spec =
+    [d|
+     instance ToJSON $(conT typ) where
+         toJSON = jsonSerializer $(varE spec)
+         toEncoding = jsonEncoder $(varE spec)
+     instance FromJSON $(conT typ) where
+         parseJSON = jsonParser $(varE spec)
+     instance ToSchema $(conT typ) where
+         declareNamedSchema p = makeDeclareNamedSchema $(varE spec) p
+    |]
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2017 Alexander Thiemann <mail@athiemann.net>
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/highjson-th.cabal b/highjson-th.cabal
new file mode 100644
--- /dev/null
+++ b/highjson-th.cabal
@@ -0,0 +1,55 @@
+name:                highjson-th
+version:             0.4.0.0
+synopsis:            Template Haskell helpers for highjson specs
+description:         Template Haskell helpers for highjson specs
+homepage:            https://github.com/agrafix/highjson
+bug-reports:         https://github.com/agrafix/highjson/issues
+license:             MIT
+license-file:        LICENSE
+author:              Alexander Thiemann <mail@athiemann.net>
+maintainer:          Alexander Thiemann <mail@athiemann.net>
+copyright:           (c) 2017 Alexander Thiemann
+category:            Text, Web, JSON
+build-type:          Simple
+stability:           experimental
+cabal-version:       >=1.10
+tested-with:         GHC==8.0.1
+
+library
+  exposed-modules:
+                  Data.HighJson.TH
+  build-depends:
+                base >=4.8 && <5,
+                highjson >= 0.4,
+                highjson-swagger >= 0.4,
+                text,
+                template-haskell >= 2.10,
+                aeson,
+                swagger2
+  hs-source-dirs:      .
+  default-language:    Haskell2010
+
+test-suite highjson-th-tests
+  type:                exitcode-stdio-1.0
+  hs-source-dirs:      test
+  main-is:             Main.hs
+  other-modules:
+                Data.HighJson.THSpec
+  build-depends:
+                QuickCheck >=2.8,
+                base,
+                highjson,
+                highjson-swagger,
+                highjson-th,
+                aeson,
+                hspec >= 2.0,
+                text,
+                lens,
+                swagger2,
+                bytestring
+  default-language:    Haskell2010
+  ghc-options: -Wall -fno-warn-orphans
+
+source-repository head
+  type:     git
+  location: git://github.com/agrafix/highjson.git
diff --git a/test/Data/HighJson/THSpec.hs b/test/Data/HighJson/THSpec.hs
new file mode 100644
--- /dev/null
+++ b/test/Data/HighJson/THSpec.hs
@@ -0,0 +1,42 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE TemplateHaskell #-}
+module Data.HighJson.THSpec
+    ( spec )
+where
+
+import Data.HighJson
+import Data.HighJson.TH
+
+import Control.Lens.TH
+import Data.Swagger
+import Test.Hspec
+import Test.QuickCheck hiding (Success)
+
+data SomeSum
+    = SomeSumInt Int
+    | SomeSumDummy Bool
+    deriving (Show, Eq)
+
+makePrisms ''SomeSum
+
+someSumSpec :: SumTypeSpec SomeSum '[Int, Bool]
+someSumSpec =
+    sumSpec "some sum" Nothing $
+    "int" .-> _SomeSumInt
+    :& "dummy" .-> _SomeSumDummy
+
+$(deriveJsonSwagger ''SomeSum 'someSumSpec)
+
+instance Arbitrary SomeSum where
+    arbitrary =
+        oneof
+        [ SomeSumInt <$> arbitrary
+        , SomeSumDummy <$> arbitrary
+        ]
+
+spec :: Spec
+spec =
+    it "should work for sum types" $
+    property $ \(t :: SomeSum) -> validateToJSON t `shouldBe` []
diff --git a/test/Main.hs b/test/Main.hs
new file mode 100644
--- /dev/null
+++ b/test/Main.hs
@@ -0,0 +1,9 @@
+module Main where
+
+import qualified Data.HighJson.THSpec
+
+import Test.Hspec
+
+main :: IO ()
+main = hspec $
+    do Data.HighJson.THSpec.spec
