diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Pedro Tacla Yamada
+
+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/app/Main.hs b/app/Main.hs
new file mode 100644
--- /dev/null
+++ b/app/Main.hs
@@ -0,0 +1,11 @@
+module Main where
+
+import           StackRunAuto
+import           System.Environment (getArgs)
+
+main :: IO ()
+main = do
+    args <- getArgs
+    case args of
+        [] -> error "Usage: stack-run-auto <file>"
+        (fname:_) -> run (Options fname)
diff --git a/app/ModulePackage.hs b/app/ModulePackage.hs
new file mode 100644
--- /dev/null
+++ b/app/ModulePackage.hs
@@ -0,0 +1,11 @@
+module Main where
+
+import           Control.Concurrent.Async
+import           Control.Monad            (void, (>=>))
+import           StackRunAuto
+import           System.Environment
+
+main :: IO ()
+main = do
+    args <- getArgs
+    void $ mapConcurrently (modulePackage >=> putStrLn) args
diff --git a/src/StackRunAuto.hs b/src/StackRunAuto.hs
new file mode 100644
--- /dev/null
+++ b/src/StackRunAuto.hs
@@ -0,0 +1,76 @@
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE RecordWildCards   #-}
+module StackRunAuto where
+
+import           Control.Concurrent.Async
+import           Control.Lens
+import           Control.Monad                   (forM_, void)
+import           Data.Aeson.Lens
+import           Data.List.Utils                 (uniq)
+import           Data.Monoid
+import           Data.String.Utils
+import qualified Data.Text                       as Text (pack, unpack)
+import           Data.Time.Clock
+import           Development.ExtractDependencies
+import           Development.FileModules
+import           Network.Wreq                    (defaults, getWith, param,
+                                                  responseBody)
+import           System.Exit
+import           System.Process
+
+data Options = Options { optsFileName :: FilePath
+                       }
+
+run :: Options -> IO ()
+run Options{..} = do
+    modules <- fileModulesVerbose optsFileName
+    packages <- mapConcurrently modulePackageVerbose modules
+    allPackages <- mapConcurrently extractDependenciesVerbose (uniq packages)
+    let argList = map ("--package " ++)
+                  (filter isValidPackage (uniq (packages ++ concat allPackages)))
+        cmd = "stack runghc " ++ optsFileName ++ " " ++ join " " argList
+    putStrLn cmd
+    ph <- runCommand cmd
+    waitForProcess ph >>= exitWith
+
+timed :: String -> IO a -> IO a
+timed msg action = do
+    start <- getCurrentTime
+    ret <- action
+    end <- getCurrentTime
+    putStrLn $ msg ++ " (" ++ show (diffUTCTime end start) ++ ")"
+    return ret
+
+isValidPackage :: String -> Bool
+isValidPackage "rts" = False
+isValidPackage _ = True
+
+fileModulesVerbose :: String -> IO [String]
+fileModulesVerbose optsFileName = timed "---> Parsed imports" $ do
+    putStrLn $ "Parsing " ++ optsFileName
+    uniq <$> fileModulesRecur optsFileName
+
+extractDependenciesVerbose :: String -> IO [String]
+extractDependenciesVerbose pkg = timed ("---> Found dependencies for " ++ pkg) $ do
+    putStrLn $ "Finding dependencies for " ++ pkg ++ "..."
+    extractDependencies pkg
+
+modulePackageVerbose :: String -> IO String
+modulePackageVerbose m = timed ("---> Found package for " ++ m) $ do
+    putStrLn $ "Finding package for " ++ m ++ "..."
+    modulePackage m
+
+modulePackage :: String -> IO String
+modulePackage m = do
+    let url = "http://hayoo.fh-wedel.de/json"
+        opts = defaults & param "query" .~ ["module:" <> Text.pack m]
+    res <- getWith opts url
+    let result = res ^.. responseBody . key "result" . values
+        moduleResults = filter isModuleResult result
+    case moduleResults of
+        [] -> error $ "No package found for " ++ m
+        (p:_) -> do
+            let pkg = Text.unpack (p ^. key "resultPackage" . _String)
+            return pkg
+  where
+    isModuleResult r = r ^. key "resultType" . _String == "module"
diff --git a/stack-run-auto.cabal b/stack-run-auto.cabal
new file mode 100644
--- /dev/null
+++ b/stack-run-auto.cabal
@@ -0,0 +1,92 @@
+name:                stack-run-auto
+version:             0.1.0.0
+synopsis:            Initial project template from stack
+description:         Please see README.md
+homepage:            http://github.com/yamadapc/stack-run-auto#readme
+license:             MIT
+license-file:        LICENSE
+author:              Pedro Tacla Yamada
+maintainer:          tacla.yamada@gmail.com
+copyright:           Copyright (c) 2015 Pedro Tacla Yamada
+category:            Development
+build-type:          Simple
+cabal-version:       >=1.10
+
+library
+  hs-source-dirs:      src
+  exposed-modules:     StackRunAuto
+  build-depends:       base >= 4.7 && < 5
+                     , time
+                     , process
+                     , text
+                     , lens-aeson
+                     , lens
+                     , wreq
+                     , MissingH
+                     , stm-containers
+                     , async
+                     , extract-dependencies
+                     , file-modules
+  default-language:    Haskell2010
+
+executable module-package
+  hs-source-dirs:      app
+  main-is:             ModulePackage.hs
+  ghc-options:         -threaded -rtsopts -with-rtsopts=-N
+  build-depends:       base
+                     , time
+                     , process
+                     , text
+                     , lens-aeson
+                     , lens
+                     , wreq
+                     , MissingH
+                     , stm-containers
+                     , async
+                     , extract-dependencies
+                     , file-modules
+                     , stack-run-auto
+  default-language:    Haskell2010
+
+executable stack-run-auto
+  hs-source-dirs:      app
+  main-is:             Main.hs
+  ghc-options:         -threaded -rtsopts -with-rtsopts=-N
+  build-depends:       base
+                     , time
+                     , process
+                     , text
+                     , lens-aeson
+                     , lens
+                     , wreq
+                     , MissingH
+                     , stm-containers
+                     , async
+                     , extract-dependencies
+                     , file-modules
+                     , stack-run-auto
+  default-language:    Haskell2010
+
+test-suite stack-run-auto-test
+  type:                exitcode-stdio-1.0
+  hs-source-dirs:      test
+  main-is:             Spec.hs
+  build-depends:       base
+                     , time
+                     , process
+                     , text
+                     , lens-aeson
+                     , lens
+                     , wreq
+                     , MissingH
+                     , stm-containers
+                     , async
+                     , extract-dependencies
+                     , file-modules
+                     , stack-run-auto
+  ghc-options:         -threaded -rtsopts -with-rtsopts=-N
+  default-language:    Haskell2010
+
+source-repository head
+  type:     git
+  location: https://github.com/yamadapc/stack-run-auto
diff --git a/test/Spec.hs b/test/Spec.hs
new file mode 100644
--- /dev/null
+++ b/test/Spec.hs
@@ -0,0 +1,2 @@
+main :: IO ()
+main = putStrLn "Test suite not yet implemented"
